-
-
Save darlanalves/99c21cb7eeaefc1147e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'), | |
concat = require('gulp-concat'), | |
wrap = require('gulp-wrap'), | |
multipipe = require('multipipe'), | |
spaceRe = /\s+/g, | |
wrapper = '(function(undefined){\n\n<%= contents %>\n}());'; | |
module.exports = function buildModule(src, dest, watch) { | |
var name = String(src).replace(spaceRe, '-'); | |
function task() { | |
var pipe = multipipe( | |
gulp.src(src), | |
concat(), | |
wrap(wrapper), | |
gulp.dest(dest) | |
); | |
pipe.on('error', function(err) { | |
console.warn(err); | |
}); | |
} | |
gulp.task(name, task); | |
gulp.watch(watch, name); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment