8000 GitHub - twada/gulp-derequire: A Gulp plugin to apply derequire to target Buffer/Stream · GitHub
[go: up one dir, main page]

Skip to content

About

A Gulp plugin to apply derequire to target Buffer/Stream

Resources

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

 

History

83 Commits

Folders and files

Repository files navigation

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.

About

A Gulp plugin to apply derequire to target Buffer/Stream

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0