-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (43 loc) · 1.47 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* global require */
var gulp = require('gulp');
var sass = require('gulp-sass');
var notify = require('gulp-notify');
var plumber = require('gulp-plumber');
var autoprefixer = require('gulp-autoprefixer');
var lec = require('gulp-line-ending-corrector');
/* Change your directory and settings here */
var settings = {
publicDir: './',
sassDir: './assets/scss',
cssDir: './assets/css',
/* change to disable system notification */
systemNotify: true,
proxy: ''
}
/**
* sass task, will compile the .SCSS files,
* and handle the error through plumber and notify through system message.
*/
gulp.task('sass', function () {
return gulp.src('./assets/sass/**/*.scss')
.pipe(plumber({
errorHandler: settings.systemNotify ? notify.onError("Error: <%= error.messageOriginal %>") : function (err) {
console.log(" ************** \n " + err.messageOriginal + "\n ************** ");
this.emit('end');
}
}))
.pipe(sass({outputStyle: 'expanded'})) /* compressed */
.pipe(autoprefixer({
browsers: ['last 6 versions'],
cascade: false
}))
.pipe(lec({verbose:true, eolc: 'CRLF', encoding:'utf8'}))
.pipe(gulp.dest('./assets/css/'))
});
gulp.task('serve', gulp.series('sass', function () {
/**
* watch for changes in sass files
*/
gulp.watch("./assets/sass/**/*.scss", gulp.series('sass'));
}));
gulp.task('default', gulp.series('serve'));