-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (39 loc) · 1.09 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
'use strict';
let config = require('./src/config.json');
let browserSync = require('browser-sync').create();
let gulp = require('gulp');
let glob = require('gulp-sass-glob');
let notify = require('gulp-notify');
let sourceMaps = require('gulp-sourcemaps');
let plumber = require('gulp-plumber');
let sass = require('gulp-sass');
// CSS.
gulp.task('css', function () {
return gulp.src(config.css.src)
.pipe(glob())
.pipe(plumber({
errorHandler: function (error) {
notify.onError({
title: "Gulp",
subtitle: "Failure!",
message: "Error: <%= error.message %>",
sound: "Beep"
})(error);
this.emit('end');
}
}))
.pipe(sourceMaps.init())
.pipe(sass({
style: 'compressed',
errLogToConsole: true,
includePaths: config.css.includePaths
}))
.pipe(sourceMaps.write())
.pipe(gulp.dest(config.css.dest))
.pipe(browserSync.reload({stream: true, match: '**/*.css'}))
});
// Watch task.
gulp.task('watch', function () {
gulp.watch(config.css.src, ['css']);
});
gulp.task('default', ['watch']);