Answer the question
In order to leave comments, you need to log in
How to save the information from the pipe into a variable and use this variable in the stream in the future?
I'm using gulp for layout, and I want to make it so that the finished layout can be converted from html
to php
for wordpress
. I'm stuck on the fact that I need to replace everything and with and . I was able to get the file paths using the module , but the problem is that I can't get everything out of the pipe and save it to a variable. I tried displaying the information at least in the console, but that didn't work either. Here is my code:<link>
<script>
wp__enque_styles
wp_enque_scripts
gulp-find
let gulp = require("gulp"),
es = require("event-stream"),
fs = require("fs"),
find = require("gulp-find"),
rename = require("gulp-rename");
const action = es => es.map((file, cb) => {
console.log(file.path);
return cb();
});
gulp.task("wp", () => {
return src(project.src.html) // открыли файл
.pipe(find(/([`"'])\S+?\.(css|js)\1/gi)) // нашли все пути
.pipe(action(es)) // вызвали вывод путей в консоль
.pipe(rename({ extname: ".php" }))
.pipe(dest(project.build.php))
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question