Skip to content

yanbingbing/gulp-wrap-factory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

factory wrapper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published