Answer the question
In order to leave comments, you need to log in
How to add a new plugin to gulpfile.js?
Hello. After adding a new plugin to my gallp assembly, for some reason it stopped working. Added template pag. Who can see what is wrong in the code?
const gulp = require('gulp'),
sass = require('gulp-sass'),
pug = require('gulp-pug'),
postcss = require('gulp-postcss'),
autoprefixer = require('autoprefixer'),
browserSync = require('browser-sync'),
babel = require('gulp-babel');
gulp.task('es6to5', () => {
return gulp.src('src/es6/common.js')
.pipe( babel({ presets: ['@babel/env'] }))
.pipe(gulp.dest('src/js'))
});
gulp.task('sass', () => {
return gulp.src('src/sass/main.scss')
.pipe(sass({outputStyle: 'expanded'}))
.pipe(postcss([ autoprefixer() ]))
.pipe(gulp.dest('src/css'))
});
gulp.task('pug-compile', ()=>{
return gulp.src(['src/pug/**/*.pug', '!src/pug/includes/**/*.pug'])
.pipe(pug({pretty:true}))
.pipe(gulp.dest('src/html'))
});
gulp.task('browser-sync', () => {
return browserSync({
server: {
baseDir: 'src'
},
notify: false
});
});
gulp.task('build', ['es6to5', 'sass', 'pug-compile']);
gulp.task('watch', ['browser-sync', 'es6to5', 'sass', 'pug-compile'], () => {
gulp.watch('src/**/*.js', ['es6to5', browserSync.reload]);
gulp.watch('src/**/*.scss', ['sass', browserSync.reload]);
gulp.watch('src/pug/**/*.pug', gulp.series('pug-compile') ['pug-compile', browserSync.reload]);
gulp.watch('src/**/*.css', browserSync.reload);
gulp.watch('src/**/*.html', browserSync.reload);
});
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