I
I
IIIu6ko2020-01-11 14:24:28
gulp.js
IIIu6ko, 2020-01-11 14:24:28

How to write a dependency task for includes?

Good afternoon. I use the gulp-file-include package to include identical pieces of html on different pages (footer, header, etc.). I recently learned about it, it looks like this:since: gulp.lastRun("html")

return gulp.src(["src/*.html", "src/blocks/**/*.html"], {base: "src", since: gulp.lastRun("html")})

The essence of the problem:
Before adding since, the watcher called the html task and all html files were selected and updated, respectively, the more html files, the longer the task runs. (For example, there are 6 pages in the project and the html task is already running for 2s., when with one page ~ 50ms.)
After adding since, only one file is taken that has been changed, and as I understand it, even a specific line, because 2s and 20ms - the difference is very significant.
But the problem is that there are no dependencies. It would be nice to make a separate task that would be called by the watcher when updating repeating pieces, and the task itself would go through all html files and update those that have these pieces, or when starting the project, create a manifest with a list of all includes and already refer to it , so it will be even faster.
Help write a similar task, or offer an alternative solution.
I will be very grateful.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
inkShio, 2020-01-11
@IIIu6ko

I use emitty (because I use pug), see if it works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question