Gulp bundle only if source files changed -
i'm pretty new gulp, easy one.
i'm trying genereate number of bundles, each of composed of bunch of js/css files (sourced file), want build each bundle if of it's source files changed.
my starting code looks following. need add make work?
gulp.task('bundle', function () { return gulp .src(sourcefile) .pipe(bundle()) .pipe(gulp.dest(builddest)) .pipe(bundle.results({ pathprefix: '/bundlepath/', dest: manifestdest })); });
sourcefile:
module.exports = { bundle: { "bundle1": { "scripts": [ "file1.js", "file2.js", "file3.js" ], "styles": "style1.css" }, "bundle2": { "scripts": [ "file1.js", "file4.js" ], "styles": [ "style1.css", "style2.css" ] } } }
for example, if file1.js changes, want both bundle1 , bundle2 rebuilt since share file1.js. if file4.js changes, bundle2 should rebuilt.
this process kicked off when release version of project built in vs2012.
i looked alternative packages gulp-changed, seem work single files (correct me if i'm wrong).
Comments
Post a Comment