Gulp task with different source depending on arguments

You were on the right track with your second try, just needed to utilize a bit of DRY and closures function createTransformTaskClosure (destination) { return function () { return gulp.src(config.sourceJSX) .pipe(gulp.dest(destination)); }; } gulp.task(‘dev’, createTransformTaskClosure(config.output_development)); gulp.task(‘prod’, createTransformTaskClosure(config.output_production));

Check if file exist in Gulp

You can use fs.access fs.access(‘/etc/passwd’, (err) => { if (err) { // file/path is not visible to the calling process console.log(err.message); console.log(err.code); } }); List of available error codes here Using fs.access() to check for the accessibility of a file before calling fs.open(), fs.readFile() or fs.writeFile() is not recommended. Doing so introduces a race condition, … Read more

Running a command with gulp to start Node.js server

gulp.task(‘server’, function (cb) { exec(‘node lib/app.js’, function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); exec(‘mongod –dbpath ./data’, function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); }) For future reference and if anyone else comes across this problem. The above code fixed my problem. So basically, I found out that the above is its … Read more

Why does gulp-useref does not seem to work with a comment in the replacement section?

The reason is version change check documentation https://www.npmjs.com/package/gulp-useref here you have an example: gulp.task(‘optimize’, [‘templateCache’, ‘images’], function(){ var templateCache = config.temp + config.templateCache.files; return gulp .src(config.index) .pipe($.plumber()) .pipe($.inject(gulp.src(templateCache, {read: false}, {starttag: ”}))) .pipe($.useref({ searchPath: ‘./’ })) .pipe(gulp.dest(config.build)); }); hope it helps

Detect release / debug in gulp using Visual Studio 2015

I know this has been around for awhile but I recently ran into the same issue and was unhappy with the other solutions and workarounds that I found in answers here on SO. I found a very nice solution that we went with in the comments on the aspnet github page: https://github.com/aspnet/Home/issues/1231#issuecomment-182017985 I hope that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)