Answer the question
In order to leave comments, you need to log in
How to add gulp reload and error output to console?
Hello!
Can you please tell me how to add reloading components to my assembler, outputting errors to the console (instead of stopping work)?
var browser = require( 'browser-sync' )
gulp = require( 'gulp' ),
pug = require( 'gulp-pug' ),
sass = require( 'gulp-sass' ),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat');
gulp.task( 'browser', function() {
browser.init({
server: {
baseDir: './dist'
},
notify: false
})
})
gulp.task( 'templates', function() {
gulp.src( './src/templates/*.pug' )
.pipe( pug({
pretty: true
}))
.pipe( gulp.dest( './dist' ) )
})
gulp.task( 'styles', function() {
gulp.src( './src/**/*.sass' )
.pipe( sass({
outputStyle: 'compressed',
errLogToConsole: true
}))
.pipe( autoprefixer({
browsers: [ 'last 2 versions' ],
cascade: false
}))
.pipe( concat( 'index.min.css' ))
.pipe( gulp.dest( './dist/static/css' ) )
})
gulp.task( 'components-template', function() {
gulp.src( './src/components/**/*.pug' )
.pipe( pug({
pretty: true
}))
})
gulp.task( 'components-style', function() {
gulp.src( './src/components/**/*.sass' )
.pipe( sass({
outputStyle: 'compressed',
errLogToConsole: true
}))
.pipe( autoprefixer({
browsers: [ 'last 2 versions' ],
cascade: false
}))
.pipe( concat( 'index.min.css' ))
.pipe( gulp.dest( './dist/static/css' ) )
})
gulp.task( 'render', gulp.parallel( 'templates', 'styles', 'components-template', 'components-style' ) )
gulp.task( 'dev', gulp.parallel( 'browser', 'render' ) )
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