Answer the question
In order to leave comments, you need to log in
How to intercept file being processed in gulp?
Actually, subject. The meaning is this: the galpa task is running, how can I intercept the file or get its url (I want to write it down in locals jade in order to pass it to jade templates)?
Answer the question
In order to leave comments, you need to log in
If you need to throw data into the template, then gulp-data . It would be more interesting for me to get a tree of all extends and include files, for example, to take data from _nav.jade.json, which, as it were, does not participate in compilation.
var getJadeDependencies = function (file) {
return require(`jade`).compileFile(file).dependencies;
};
If I understand correctly: hang after gulp.src gulp-filenames , then at the end of the stream, run the jade bundle with the entire list of files from the stream.
Offtopic:
Personally, I use this pattern: there is a certain json file into which I throw everything that I may need at the same time in js, jade or stylus, and then I pull it apart through locals (jade gult), require (js babel) and json ( style).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question