0.3.0 • Published 1 year ago

@stomydent/gulp-include-file v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

gulp-include-file

Include the contents of a file inside a javascript file. This module will read the contents of the file specified and then create a javascript string which will be injected at the place specified.

Forked from tweedegolf/gulp-include-file

Install

npm install gulp-include-file

Example

Given the following javascript file:

function getText() {
  return INCLUDE_FILE("example.txt");
}

And the following example.txt in the same directory:

Hello world!

This is a string.

This module will generate the following file:

function getText() {
  return "Hello world\n\nThis is a string.";
}

Using this example gulpfile:

var gulp = require('gulp');
var include_file = require('gulp-include-file');

gulp.task('example', function () {
  gulp.src('./src/scripts/**/*.js')
    .pipe(include_file())
    .pipe(gulp.dest('./dist'));
});

Options

  • regex RegExp: The regex to use instead of the default one.
  • transform Function: The transform function to use instead of the default one.
  • rootDirs Array: Define multiple directories for file resolution.

License

This module is released under the MIT license.

0.3.0

1 year ago

0.2.0

1 year ago