V
V
VloVer2020-03-12 13:25:02
gulp.js
VloVer, 2020-03-12 13:25:02

Rewrite task under gulp 4?

Help me rewrite the task from 3 gulp to 4

var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var concatCSS = require('gulp-concat-css');
var browserSync = require('browser-sync');
var rename = require('gulp-rename');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
var ftp = require('gulp-ftp');

// Start server + debug sass/html files
gulp.task('serve', ['sass'], function() {

browserSync.init({
server: "./src",
notify: false,
host: "185.27. 134.11"

});

gulp.watch("
gulp.watch("src/*.html").on('change', browserSync.reload);
});

// Compile sass to CSS and paste changes into browser
gulp.task('sass', function() {
return gulp.src("src/sass/**/*.sass")
.pipe(sass())
.pipe (autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(concatCSS('style.css'))
.pipe(gulp.dest("src/css"))
.pipe(browserSync .stream());
});

gulp.task('default', ['serve']);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2020-03-12
@delphinpro

In general, it is enough to change such constructions
gulp.task('default', ['serve']);
to calls gulp.series / gulp.parallel

gulp.task('default', function(done){
  gulp.series(
    'serve'
  )(done)
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question