gulp-jsclosure
v0.0.1
Published
Gulp Plugin that wraps your file in a configurable javascript closure
Downloads
814
Maintainers
Readme
gulp-jsclosure
Javascript closure creator for gulp.
var closure = require('gulp-jsclosure');
Sample
A simple javascript file (file.js):
var a = 1;
var b = 2;
Options: null
;(function() {
var a = 1;
var b = 1;
})();
Options: array (e.g. closure(['angular', 'window']))
;(function(angular, window) {
var a = 1;
var b = 2;
})(angular, window);
Options: object (e.g. closure({angular:true, window: true}))
;(function(angular, window) {
var a = 1;
var b = 2;
})(angular, window);
Example Usage
gulp.src('./js/*.js')
.pipe(closure())
.pipe(gulp.dest('./dist/'));
gulp.src('./js/*.js')
.pipe(closure({ window: true , document: true }))
.pipe(gulp.dest('./dist/'));
gulp.src('./js/*.js')
.pipe(closure(['window', 'document']))
.pipe(gulp.dest('./dist/'));
License
MIT