J
J
jungoboy2019-04-17 14:59:48
gulp.js
jungoboy, 2019-04-17 14:59:48

How to translate a ready assembly of gulp + sass to version 4 of gulp'a?

gulpfile.js itself

spoiler
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);
});

I just can't rewrite it, please help...
upd: Who can't help a newbie? Tell me what commands you need to write in order to run the project with the updated gulpfile.js
- Link to the entire project: (with the old gulpfile.js) *Poke*

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daniil Maslov, 2019-04-17
@jungoboy

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);
}));

I didn’t check the work on your project, if there are errors, write in the comments which ones.

A
Andrew, 2019-04-17
@Welens

https://youtu.be/kesyrCZE1bA

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question