javascript - gulp.src from a separate file doesnt work -
i trying write gulpfile follows :
var gulp = require('gulp'); // other dependencies go here .... // source of files var inputs = require('./asset_source.js'); // simple task gulp.task('css', function () { gulp.src(inputs.css) .pipe(debug()) .pipe(plumber()) .pipe(maps.init()) .pipe(concatcss('libs.css')) .pipe(maps.write('../srcmaps')) .pipe(plumber.stop()) .pipe(gulp.dest('assets/css')); }); // watcher gulp.task('watch', function () { gulp.watch('./asset_source.js', ['css']); }); // default task gulp.task('default', ['browser-sync', 'watch']);
and source of assets (asset_source.js) file :
module.exports = { css: [ 'path/to/a/file.css', 'path/to/another/file.css', ....... ....... ], js: [ 'path/to/a/file.js', 'path/to/another/file.js', ....... ....... ] };
now run app typing gulp in console , starts in browser browsersync. have css,scss,js assets listed in asset_source.js file in same directory gulpfile.js. want achieve if append or remove value to/from either of arrays in asset_source.js, concerned task should run while gulp running. in case css should running on change asset_source.js updated content.
but instead doesnt so. if there change in asset_source file, gulp uses initial content , runs task. if run gulp css in separate terminal, works.
please me going wrong or if possible. thanks.
Comments
Post a Comment