forked from Trowel/trowel.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
57 lines (46 loc) · 1.21 KB
/
gulpfile.babel.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
49
50
51
52
53
'use strict';
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
const $ = gulpLoadPlugins();
const reportError = function(err) {
$.notify({
title: 'An error occured with a gulp task',
}).write(err);
console.log(err.toString());
this.emit('end');
}
const config = {
'sass': {
precision: 6,
outputStyle: 'expanded',
sourceComments: true,
indentWidth: 4,
},
'autoprefixer': {
browsers: [
'ie >= 10',
'ie_mob >= 10',
'ff >= 30',
'chrome >= 34',
'safari >= 7',
'opera >= 23',
'ios >= 7',
'android >= 4.4',
'bb >= 10'
]
},
}
gulp.task('styles', () => {
return gulp.src('./style/main.scss')
.pipe($.sourcemaps.init())
.pipe($.sassGlob())
.pipe($.sass(config.sass)).on('error', reportError)
.pipe($.autoprefixer(config.autoprefixer))
.pipe($.sourcemaps.write())
.pipe($.cssmin())
.pipe(gulp.dest('./assets/css'))
});
gulp.task('default', ['styles']);
gulp.task('watch', ['default'], () => {
gulp.watch('./style/**/*.{scss, css}', ['styles']);
});