gulp-wrap-factory

1.2.1 • Public • Published

gulp-wrap-factory

Wrap Factory module

Install

npm install --save-dev gulp-wrap-factory

Example

var gulp = require('gulp'),
    wrap = require('gulp-wrap-factory');
 
gulp.task('default', function(){
    return gulp.src('fn-module.js')
        .pipe(wrap({ name: 'Base' }))
        .pipe(gulp.dest('dest/'));
});

Example input:

// my coding goes here.
console.info(this, window, document);

Example output (name: 'Base'):

(function (global, factory) {
    if (typeof exports !== "undefined") {
        module.exports = factory;
    } else {
        global.Base = factory;
    }
})(this, function (window, document) {
    (function () {
        // my coding goes here.
        console.info(this, window, document);
    }).call(window)
});

Options

String name - valid name of global variable which should be available in browser.

Readme

Keywords

Package Sidebar

Install

npm i gulp-wrap-factory

Weekly Downloads

1

Version

1.2.1

License

MIT

Last publish

Collaborators

  • onbing