gulp-watch

Can I use gulp-imagemin with gulp-watch?

蓝咒 提交于 2021-02-08 02:10:35
问题 Can I use gulp-imagemin plugin with gulp-watch? So, I need to optimize images as soon as they are put into the folder. Here is a part of my gulpfile.js: var gulp = require('gulp'); var imagemin = require('gulp-imagemin'); var pngquant = require('imagemin-pngquant'); gulp.task('default', function() { gulp.watch('dist/images/**', function(event) { gulp.run('images'); }); }); // Image files gulp.task('images', function () { return gulp.src('src/images/*') .pipe(imagemin({ progressive: true,

Everytime I run gulp anything, I get a assertion error. - Task function must be specified

ⅰ亾dé卋堺 提交于 2020-01-28 15:03:28
问题 I'm trying to run the command below but unfortunately I run into errors. $ gulp build In my terminal and I get this assertion error. I've uninstalled node and NPM and reinstalled again using brew - How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) with these steps. My node version is v10.5.0 and npm version is 6.1.0 . My system is MacOS High Sierra 10.13.2 assert.js:269 throw err; ^ AssertionError [ERR_ASSERTION]: Task function must be specified at Gulp.set [as

Everytime I run gulp anything, I get a assertion error. - Task function must be specified

点点圈 提交于 2020-01-28 14:59:13
问题 I'm trying to run the command below but unfortunately I run into errors. $ gulp build In my terminal and I get this assertion error. I've uninstalled node and NPM and reinstalled again using brew - How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) with these steps. My node version is v10.5.0 and npm version is 6.1.0 . My system is MacOS High Sierra 10.13.2 assert.js:269 throw err; ^ AssertionError [ERR_ASSERTION]: Task function must be specified at Gulp.set [as

Everytime I run gulp anything, I get a assertion error. - Task function must be specified

安稳与你 提交于 2020-01-28 14:57:28
问题 I'm trying to run the command below but unfortunately I run into errors. $ gulp build In my terminal and I get this assertion error. I've uninstalled node and NPM and reinstalled again using brew - How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) with these steps. My node version is v10.5.0 and npm version is 6.1.0 . My system is MacOS High Sierra 10.13.2 assert.js:269 throw err; ^ AssertionError [ERR_ASSERTION]: Task function must be specified at Gulp.set [as

Aurelia CLI app-bundle automatic update gets slow

不打扰是莪最后的温柔 提交于 2020-01-01 11:42:10
问题 Hi I have a web application runnig on the Aurelia CLI. From what I’ve read in the documentation, the Aurelia CLI runs always “bundled” and never targeting directly source files. By running the “au run –watch” command, Aurelia “listens” to file changes and recreates the app-bundle.js automatically. Sample output from console: Starting 'readProjectConfiguration'... Finished 'readProjectConfiguration' Starting 'processMarkup'... Starting 'processCSS'... Starting 'configureEnvironment'...

Aurelia CLI app-bundle automatic update gets slow

谁说我不能喝 提交于 2020-01-01 11:41:15
问题 Hi I have a web application runnig on the Aurelia CLI. From what I’ve read in the documentation, the Aurelia CLI runs always “bundled” and never targeting directly source files. By running the “au run –watch” command, Aurelia “listens” to file changes and recreates the app-bundle.js automatically. Sample output from console: Starting 'readProjectConfiguration'... Finished 'readProjectConfiguration' Starting 'processMarkup'... Starting 'processCSS'... Starting 'configureEnvironment'...

Aurelia CLI app-bundle automatic update gets slow

吃可爱长大的小学妹 提交于 2020-01-01 11:41:10
问题 Hi I have a web application runnig on the Aurelia CLI. From what I’ve read in the documentation, the Aurelia CLI runs always “bundled” and never targeting directly source files. By running the “au run –watch” command, Aurelia “listens” to file changes and recreates the app-bundle.js automatically. Sample output from console: Starting 'readProjectConfiguration'... Finished 'readProjectConfiguration' Starting 'processMarkup'... Starting 'processCSS'... Starting 'configureEnvironment'...

How to pass a parameter to gulp-watch invoked task

醉酒当歌 提交于 2020-01-01 11:39:48
问题 I am trying to pass a parameter to a task that is being invoked by gulp-watch. I need it because I am trying to build a modular framework. So if a file changes in module 1, the other modules don't need to be rebuild. And I want just one function to create the concatted & uglified files per module. This is what I got so far: //here I need the 'module' parameter gulp.task('script', function(module) { ... } gulp.task('watch', function() { gulp.watch('files/in/module1/*.js', ['script']); //here I

Gulp-watch is not picking up new files

安稳与你 提交于 2020-01-01 04:46:07
问题 I'm trying to run a task whenever a file get's changed, delete or a new file is added. The first two work, however: when a new file is added it's not being picked up. I installed the package gulp-watch and I have this task: var gulp = require('gulp'), watch = require('gulp-watch'); gulp.task('watch', function() { watch( ['./src/Scripts/**/*.js'], function(ev, cb) { console.log('test'); cb(); }); }); 回答1: That was a weird problem. Removing ./ from glob fixes it. var gulp = require('gulp'); var

Gulp: how to pass parameters from watch to tasks

∥☆過路亽.° 提交于 2019-12-28 18:44:22
问题 With gulp you often see patterns like this: gulp.watch('src/*.jade',['templates']); gulp.task('templates', function() { return gulp.src('src/*.jade') .pipe(jade({ pretty: true })) .pipe(gulp.dest('dist/')) .pipe( livereload( server )); }); Does this actually pass the watch'ed files into the templates task? How do these overwrite/extend/filter the src'ed tasks? 回答1: I had the same question some time ago and came to the following conclusion after digging for a bit. gulp.watch is an eventEmitter