-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the documentation: explain how to watch files from the command line #2322
Improve the documentation: explain how to watch files from the command line #2322
Comments
I don't know if this is best practice, but it works (without using const gulp = require('gulp');
function css(cb){
const postcss = require('gulp-postcss')
cb();
return gulp.src('src/style.css')
// ...
.pipe(postcss([
// ...
require('autoprefixer'),
// ...
]))
// ...
.pipe(gulp.dest('./src'))
}
gulp.task('default', function() {
gulp.watch(['./src/style.css'], {ignoreInitial: false}, css)
}) The key is to use |
@AeonFr that's not quite right. I've updated the examples in that tutorial article so they all export a default task. |
Thanks @phated. The key point is to call the Just for the sake of learning (bc right now it's working), how would one use the It would be nice if the documentation had at least one example with a proper Again, thanks for replying. |
@AeonFr The Async Completion guide explains the usage of an error-first callback (if you aren't able to return a stream, but you are already doing that so you don't need to use the callback). |
Got it! Thanks, removing |
Hello. I just did a fresh install on node and gulp.
I'm following the documentation at https://gulpjs.com/docs/en/getting-started/watching-files
The code samples explain how to set up a gulpfile to watch files. Yet, after trying to run
gulp
,gulp --watch
or any other command using the sample gulpfile, I encounter an error:[15:54:06] Task never defined: default
It would be nice if the site explained how to use the code sample it provides. For newbies like me.
A google search points out on that documentation article as first result, and other tutorials seem to be old, that's why I find this necessary.
For now I will continue using the gulp-watch npm package.
Thanks.
The text was updated successfully, but these errors were encountered: