gulp-derequire
A Gulp plugin to apply derequire to target Buffer/Stream
Last updated 5 years ago by twada .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gulp-derequire 
SYNC missed versions from official npm registry.

gulp-derequire

NPM version Build Status Dependency Status

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:

var derequire = require('gulp-derequire');
var browserify = require('browserify');
var source = require('vinyl-source-stream');

gulp.task('build', function() {
    var 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

var derequire = require('gulp-derequire');
var browserify = require('browserify');
var source = require('vinyl-source-stream');

gulp.task('build', function() {
    var 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

License

Licensed under the MIT license.

Current Tags

  • 2.1.0                                ...           latest (5 years ago)

10 Versions

  • 2.1.0                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.3.1                                ...           5 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.1                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 1
This Week 2
This Month 78
Last Day 1
Last Week 14
Last Month 100
Dependencies (4)
Dev Dependencies (3)

Copyright 2014 - 2016 © taobao.org |