V
V
Vlad ~2019-02-16 10:44:21
gulp.js
Vlad ~, 2019-02-16 10:44:21

How to set tracking for html (Gulp)?

I started using galp recently and faced the problem of tracking html changes,
please tell me what is wrong here and how to fix it

gulp.task('html', function(){
return gulp.src('./build/**/*.html')
.pipe(gulp.dest('./build/**/*.html'))
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Solntsev, 2019-02-23
@examp1

gulp API, watch function: gulp.watch()
If on the fingers:
watch(globs, [options], [task])
globs - string or array - set where and what to track: file path
[options] - object with options, everything is in the dock. Optional argument.
[task] - a task to be run or a set of tasks via gulp.series, gulp.parallel. Or a function.
gulp.watch('entry/html/**/*.html', html);
Something like that.
For reference: info appeared in the dock that creating tasks via gulp.task(...) is no longer good and needs to be connected via exports
like:
const task1 = () => {};
exports.task1 = task1;
Now I am rewriting my basic assembly, so far I like it - it looks more concise.

A
Arseny, 2019-02-16
Matytsyn @ArsenyMatytsyn

This task does not track anything, it just takes and builds on command. You need gulp-watch with your monet.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question