gulp-require-file

1.1.2 • Public • Published

gulp-require-file npm version

Description

Processes 'require', 'require_directory', and 'require_tree' directives for inclusion of source files similar to Sprockets. Built with inspiration from gulp-include.

Installation

npm install --save-dev gulp-require-file

Usage

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");

Options

  • 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' }})

Supported Directives

The require Directive

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.

The require_directory Directive

require_directory path requires all source files of the same format in the directory specified by path. Files are required in alphabetical order.

The require_tree Directive

require_tree path works like require_directory, but operates recursively to require all files in all subdirectories of the directory specified by path.

Run Tests

cd path/to/gulp-require-file
npm install
npm test

Readme

Keywords

Package Sidebar

Install

npm i gulp-require-file

Weekly Downloads

5

Version

1.1.2

License

MIT

Last publish

Collaborators

  • plurch