There are other questions on stackoverflow about this topic, but not the one I was hoping for.
Here is a simplified version of my gulpfile.js
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('css', function() {
gulp.src('site/scss/style.scss')
.pipe(sass())
.pipe(gulp.dest('assets/css'))
});
gulp.task('watch', function() {
gulp.watch('site/scss/**/*.scss', ['css']);
});
I can do this successfully:
gulp watch
Now I want to be able to do something like this in my terminal command line:
gulp watch my-domain-name
or
gulp watch my-other-domain
My gulpfile would in my mind look something like this:
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('css', function(name) {
gulp.src('site/scss/style.scss')
.pipe(sass())
.pipe(gulp.dest('assets/css'))
});
gulp.task('watch', function(name) {
gulp.watch('site/scss/**/*.scss', ['css', name]);
});
I try to send name
around as a variable of my watch task. In my case it would be my-domain-name
or my-other-domain
depending on what I write in my terminal.
How can I send a parameter from the terminal to the watch task and then over to the css task?