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' ) )