Answer the question
In order to leave comments, you need to log in
How to translate a ready assembly of gulp + sass to version 4 of gulp'a?
gulpfile.js itself
var gulp = require("gulp");
var sass = require("gulp-sass");
var plumber = require("gulp-plumber");
var server = require("browser-sync").create();
gulp.task("style", function() {
gulp.src("./site/sass/**/*.scss")
.pipe(plumber())
.pipe(sass())
.pipe(gulp.dest("./site/css"))
.pipe(server.stream());
});
gulp.task("serve", ["style"], function () {
server.init({
server: "site/.",
notify: false,
open: true,
cors: true,
ui: false
});
gulp.watch("./site/**/*.scss", ["style"]);
gulp.watch("*.html").on("change", server.reload);
});
Answer the question
In order to leave comments, you need to log in
First in the console (if not previously installed):npm i -g gulp-cli
var gulp = require("gulp");
var sass = require("gulp-sass");
var plumber = require("gulp-plumber");
var server = require("browser-sync").create();
gulp.task("style", function() {
return gulp.src("./site/sass/**/*.scss")
.pipe(plumber())
.pipe(sass())
.pipe(gulp.dest("./site/css"))
.pipe(server.stream());
});
gulp.task("serve", gulp.series(["style"], function () {
server.init({
server: "site/.",
notify: false,
open: true,
cors: true,
ui: false
});
gulp.watch("./site/**/*.scss", gulp.parallel(["style"]));
gulp.watch("*.html").on("change", server.reload);
}));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question