Answer the question
In order to leave comments, you need to log in
Error: Content Security Policy?
Please tell me how to fix this problem in Firefox.
Here is the gulp code if needed:
const gulp = require("gulp")
const rename = require("gulp-rename")
const sass = require("gulp-sass")
const pug = require("gulp-pug")
const autoprefixer = require("gulp-autoprefixer")
const sourcemaps = require("gulp-sourcemaps")
const browserSync = require("browser-sync").create()
function localHost(done){
browserSync.init({
server:{
baseDir:"./"
}
})
done()
}
function copyTask(done){
gulp.src("./dev/sass/*")
.pipe(sourcemaps.init())
.pipe(sass({
errorLogToConsole:true,
outputStyle:"compressed"
}))
.on('error',console.error.bind(console))
.pipe(autoprefixer({
overrideBrowserslist:["last 2 versions"],
cascade: false
}))
.pipe(rename({suffix:".min"}))
.pipe(sourcemaps.write("./"))
.pipe( gulp.dest("./dev/result/css/"))
.pipe(browserSync.stream())
done()
}
function copyTaskHtml(done){
gulp.src("./dev/index.pug")
.pipe(pug({
errorLogToConsole:true,
pretty:true
}))
.on('error',console.error.bind(console))
.pipe(gulp.dest("./dev/result/"))
.pipe(browserSync.stream())
done()
}
function watchTask(){
gulp.watch("./dev/sass/**/*",copyTask)
gulp.watch("./dev/*",copyTaskHtml)
}
gulp.task("default" , gulp.parallel(watchTask,localHost))
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