Answer the question
In order to leave comments, you need to log in
How to rebuild gulp build under less?
Tell me how to convert the assembly of gulp from sass to less? ... I took up the study of Gulp but could not find it
var gulp = require('gulp');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var browserSync = require('browser-sync').create();
function copy(done) {
gulp.src('./scss/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
errorLogToConsole: true
}))
.on('error', console.error.bind(console))
.pipe(autoprefixer({
cascade: false
}))
.pipe(sourcemaps.write('./'))
.pipe( gulp.dest('./css/') )
.pipe(browserSync.stream());
done();
}
function sync(done) {
browserSync.init({
server: {
baseDir: "./"
},
port: 3000
});
done();
}
function browserReload(done) {
browserSync.reload();
done();
}
function watchSass(){
gulp.watch("./scss/**/*", copy);
}
function watchFiles(){
gulp.watch("./scss/**/*", copy);
gulp.watch("./**/*.html", browserReload);
gulp.watch("./**/*.php", browserReload);
gulp.watch("./**/*.js", browserReload);
}
gulp.task('default', gulp.parallel(sync, watchFiles));
gulp.task(sync);
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