gulp-derequire

    3.0.0 • Public • Published

    gulp-derequire

    Build Status NPM version Code Style License

    A gulp plugin for derequire.

    Description

    gulp-derequire is a gulp plugin to apply derequire to target Buffer/Stream. It's useful when you are building standalone module using browserify with gulp.

    Usage

    First, install gulp-derequire as a development dependency:

    npm install --save-dev gulp-derequire

    Then, add it to your gulpfile.js:

    const derequire = require('gulp-derequire');
    const browserify = require('browserify');
    const source = require('vinyl-source-stream');
     
    gulp.task('build', () => {
        const bundleStream = browserify({entries: './index.js', standalone: 'yourModule'}).bundle();
        return bundleStream
            .pipe(source('yourModule.js'))
            .pipe(derequire())
            .pipe(gulp.dest('./build'));
    });

    API

    derequire(parameters)

    Note: parameters are passed verbatim to derequire so see its readme for options

    customization example

    to change both require and define

    const derequire = require('gulp-derequire');
    const browserify = require('browserify');
    const source = require('vinyl-source-stream');
     
    gulp.task('build', () => {
        const bundleStream = browserify({entries: './index.js', standalone: 'yourModule'}).bundle();
        return bundleStream
            .pipe(source('yourModule.js'))
            .pipe(derequire([
                {
                    from: 'require',
                    to: '_dereq_'
                },
                {
                    from: 'define',
                    to: '_defi_'
                }
            ]))
            .pipe(gulp.dest('./build'));
    });

    Author

    Support Policy

    Supports Node under maintenance. In other words, we stop supporting old Node versions when their maintenance ends. Any other environments are not supported officially (means that we do not test against them on CI service).

    License

    Licensed under the MIT license.

    Install

    npm i gulp-derequire

    DownloadsWeekly Downloads

    1,296

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    9.1 kB

    Total Files

    5

    Last publish

    Collaborators

    • twada