Answer the question
In order to leave comments, you need to log in
How to make dynamic generation for dest depending on src?
The layout is developed in a modular way, separating each logical block into a folder . It is
necessary that during the operation of any task that looks at files by type
component/#компоненты#/"файлы"
function html(){
return gulp.src( './component/*/*.html' )
.pipe( include() ) //Совершили какое-то действие... минификация, компиляция, всё что угодно
.pipe( gulp.dest('build/#Путь откуда взяли#') ); //Как получить путь, откуда взят файл?
}
Answer the question
In order to leave comments, you need to log in
Solved the problem, found a module that returns an array with directories.
function generateFolderMap(fileDir){
let fs = require('fs');
let result = fs.readdirSync(fileDir, { withFileTypes: true })
.filter(a => a.isDirectory())
.map(a => a.name);
return result;
}
module.exports = generateFolderMap;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question