Answer the question
In order to leave comments, you need to log in
How to change file path in html on build?
Plz tell me how to change the style path in the html file?
I'm building a project from the dev folder in build. Inside dev is index.html c
during assembly, this path should be replaced by
There is a solution to take index.html to the root, but I would like to understand just such a path)
gulpfile.js<link rel="stylesheet" href="less/main.less">
<link rel="stylesheet" href="css/main.css">
const path = require('path');
const { src, dest, parallel, series } = require('gulp');
const clean = require('gulp-clean');
const less = require('gulp-less');
const autoprefixer = require('gulp-autoprefixer');
const changed = require('gulp-changed');
const watch = require('gulp-watch');
const clear = () => {
return src('./build/css', { read: false }).pipe(clean());
};
const html = () => {
return src('./dev/*.html').pipe(dest('./build'));
};
const css = () => {
return src('./dev/less/**/*.less')
.pipe(changed('./build/css/'))
.pipe(less())
.pipe(autoprefixer())
.pipe(dest('./build/css'));
};
const observe = () => {
watch('./dev/less/**/*.less', css);
watch('./dev/*.html', html);
};
exports.default = series(clear, parallel(observe));
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