@yodasws/gulp-file-includer

1.1.1 • Public • Published

gulp-file-includer

A file include plugin for gulp 3

npm-url

Installation

yarn add --dev gulp-file-includer

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

Package Sidebar

Install

npm i @yodasws/gulp-file-includer

Weekly Downloads

0

Version

1.1.1

License

MIT

Unpacked Size

97 kB

Total Files

24

Last publish

Collaborators

  • yodasws