javascript - Deleting files in a gulp task -


i have gulp task in want take source files , copy them build/premium , build/free , remove files build/free.

my attempt @ doing this:

gulp.task("build", ["clean"], function () {   gulp.src(["src/*", "!src/composer.*", "license"])     .pipe(gulp.dest("build/premium"))     .pipe(del(["build/free/plugins/*", "!build/free/plugins/index.php"]))     .pipe(gulp.dest("build/free")); }); 

which results in error:

typeerror: dest.on not function     @ destroyabletransform.stream.pipe (stream.js:45:8)     @ gulp.<anonymous> (/users/gezim/projects/myproj/gulpfile.js:9:6) 

how accomplish deleting port? there better way altogether this?

i use gulp-filter drop should not copied 2nd destination.

i interpreted intent of task wanting present in src present in build/premium. however, build/free should exclude in src/plugins should still include src/plugins/index.php.

here working gulpfile:

var gulp = require("gulp"); var filter = require("gulp-filter"); var del = require("del");  gulp.task("clean", function () {   return del("build"); });  gulp.task("build", ["clean"], function () {   return gulp.src(["src/**", "!src/composer.*", "license"])     .pipe(gulp.dest("build/premium"))     .pipe(filter(["**", "!plugins/**", "plugins/index.php"]))     .pipe(gulp.dest("build/free")); }); 

the patterns passed filter relative paths. since gulp.src pattern has src/** means relative src.

note del cannot passed straight .pipe() returns promise. can returned task, clean task does.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -