Answer the question
In order to leave comments, you need to log in
Gulp how to do tracking js and scss files?
Hello, I have the following config:
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const babel = require('gulp-babel');
gulp.task('js', () => {
return gulp.src('assets/js/app.js')
.pipe(babel({
presets: ['env']
}))
.pipe(gulp.dest('public'))
});
gulp.task('sass', () => {
return gulp.src('./assets/scss/style.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./public'));
});
gulp.watch('./assets/scss/style.scss', gulp.series('sass'));
gulp.watch('./assets/js/app.js', gulp.series('js'));
"start": "lite-server | gulp sass | gulp js"
Answer the question
In order to leave comments, you need to log in
gulp.task('watch', () => {
gulp.watch('./assets/scss/style.scss', gulp.series('sass'));
gulp.watch('./assets/js/ app.js', gulp.series('js'));
});
gulp.task(
'default',
gulp.series(
'sass',
'js',
'watch'
));
Run with gulp command
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question