Processes 'require', 'require_directory', and 'require_tree' directives for inclusion of source files similar to Sprockets. Built with inspiration from gulp-include.
npm install --save-dev gulp-require-file
var gulp = require('gulp'),
requireFile = require('gulp-require-file');
gulp.task("scripts", function() {
return gulp.src('src/js/app.js')
.pipe( requireFile() )
.pipe( gulp.dest("dist/js") );
});
gulp.task("default", "scripts");
-
globOptions
(optional)Options that will be passed through to glob.sync. Can be used to customize the matching files to include.
Example:
// Ignore files with ".es6.js" extension requireFile({ globOptions: { ignore: '**/*.es6.js' }})
require
path inserts the contents of the asset source file
specified by path. If the file is required multiple times, it will
appear in the bundle only once.
require_directory
path requires all source files of the same
format in the directory specified by path. Files are required in
alphabetical order.
require_tree
path works like require_directory
, but operates
recursively to require all files in all subdirectories of the
directory specified by path.
cd path/to/gulp-require-file
npm install
npm test