Skip to content

a plugin of gulp for file includer, based on grunt plugin - grunt-file-include. Added extra global versions

License

Notifications You must be signed in to change notification settings

Pictela/gulp-file-includer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-file-includer NPM version Build status

A file include plugin for gulp 3

Installation

First, install gulp-file-includer as a development dependency:

npm install --save-dev gulp-file-includer

Usage

Add it to your gulpfile.js:

var gulp = require('gulp')
var fileincluder = require('../index')

gulp.task('fileincluder', function() {
  gulp.src(['index.html'])
    .pipe(fileincluder())
    .pipe(gulp.dest('./result/'))
});

gulp.task('default', function() {
  gulp.run('fileincluder')
})

index.html

<!DOCTYPE html>
<html>
  <body>
  @@include('./view.html')
  @@include('./var.html', {"name": "haoxin", "age": 12345})
  </body>
</html>

view.html

<h1>view</h1>

var.html

<label>@@name</label>
<label>@@age</label>

and the result is:

<!DOCTYPE html>
<html>
  <body>
  <h1>view</h1>
  <label>haoxin</label>
<label>12345</label>
  </body>
</html>

API

gulp-file-includer can be called with a config object with these attributes:

  • prefix (defaults to '@@')
  • suffix (defaults to '')
  • basePath (defaults to '') If specified, the default root for the file path.

License

MIT

About

a plugin of gulp for file includer, based on grunt plugin - grunt-file-include. Added extra global versions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages