gulp-wrap-factory
v1.2.1
Published
wrap factory module
Downloads
7
Readme
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.