-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
30 lines (26 loc) · 900 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const gulp = require('gulp');
const sass = require('gulp-sass');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const sourcemaps = require('gulp-sourcemaps');
const log = require('fancy-log');
const sassSourceFile = 'assets/scss/main.scss';
const outputFolder = 'static/css';
const watchedResources = 'assets/scss/**/*';
gulp.task('scss', function (done) {
gulp.src(sassSourceFile)
.pipe(sourcemaps.init())
.pipe(sass().on('error', function(err){
log.error(err.message);
}))
.pipe(postcss([autoprefixer, cssnano]))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(outputFolder))
.on('end', done);
});
gulp.task('watch', gulp.series('scss', function (done) {
gulp.watch(watchedResources, gulp.parallel('scss'));
done();
}));
gulp.task('default', gulp.series('watch', function () {}));