-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
51 lines (47 loc) · 1.24 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
49
50
51
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')({
'rename' : {
'gulp-util' : 'gutil',
}
});
// A single variable to hold all the paths
var paths = {
'styles' : ['./assets/scss/**/*.scss'],
};
// Compile and minify SCSS files
gulp.task('styles', function() {
'use strict';
return gulp.src(paths.styles)
.pipe(plugins.plumber(
function(err) {
plugins.gutil.log(plugins.gutil.colors.red( 'Error on ' + err.plugin + '\n' + err.messageFormatted ) );
plugins.gutil.beep();
this.emit('end');
}
))
.pipe(plugins.sass({
'includePaths' : require('node-normalize-scss').with('./assets/scss/style.scss')
}))
.pipe(plugins.autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest('./dist/css'))
.pipe(plugins.rename({
'suffix' : '.min'
}))
.pipe(plugins.cssnano())
.pipe(gulp.dest('./dist/css'))
.pipe(plugins.notify({
'message' : 'Styles updated',
'onLast' : true
}));
});
// Live update these files
gulp.task('watch', function() {
'use strict';
gulp.watch(paths.styles, ['styles']);
plugins.livereload.listen();
gulp.watch(['./dist/**/*']).on('change', plugins.livereload.changed);
});
gulp.task('default', [
'styles',
'watch'
]);