Answer the question
In order to leave comments, you need to log in
What is the jamb of task processing?
Hello!
I have another question about setting up tasks ... Such a thing, I don’t understand what the problem is.
Foreword:
1. I work in Vizhla, using Live Server and Live Sass Compiler
2. set up a hapfile, connected tasks for PUG, SASS, JS:
gulp.task('pug', function buildHTML() {
return gulp.src('build/pug/pages/*.pug')
.pipe(pug({pretty: true}))
.pipe(gulp.dest('.'))
});
gulp.task('sass', () => {
return gulp.src(['global.css', 'aside.css'].map(file => `build/css/${file}`))
.pipe(sourcemaps.init())
.pipe(concat('style.css'))
.pipe(mmq({log: true}))
.pipe(cleanCSS()) //- minify css
.pipe(rename({suffix: ".min"}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('css'))
});
gulp.task('scripts', () => {
return gulp.src('build/js/*.js')
.pipe(sourcemaps.init())
.pipe(babel({presets: ['@babel/preset-env']}))
.pipe(concat('scripts.js'))
.pipe(uglify()) //- minify js
.pipe(rename({suffix: ".min"}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('js'))
});
gulp.task('component-assembly', function () {
gulp.watch('build/pug/pages/*.pug'), gulp.series('pug');
gulp.watch('build/css/*.css'), gulp.series('sass');
gulp.watch('build/js/*.js', gulp.series('scripts'));
});
gulp.task('watch', gulp.parallel('pug', 'sass', 'scripts', 'component-assembly'));
gulp watch
- the task works, but does not process as it is necessary. Rather, it starts and even the "first phase" works, but nothing happens with subsequent changes in the files. Those. The task seems to hang, although the tracking continues in the terminal.> watch: Finished 'pug' after 934 ms
> watch: Finished 'scripts' after 1.08 s
> watch: Finished 'sass' after 1.12 s
Answer the question
In order to leave comments, you need to log in
gulp.serial(
gulp.parallel('pug', 'sass', 'scripts'),
'component-assembly'
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question