-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
83 lines (63 loc) · 2.18 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var beep = require('beepbeep');
var autoprefixer = require('gulp-autoprefixer');
var rimraf = require('gulp-rimraf');
var colors = require('colors');
var livereload = require('gulp-livereload');
gulp.task('sass:dev', function () {
console.log('[sass]'.bold.magenta + ' Compiling development CSS');
return gulp.src('scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'expanded',
sourceMap: true
}))
.on('error', function (error) {
beep();
console.log('[sass]'.bold.magenta + ' There was an issue compiling Sass'.bold.red);
console.error(error.message);
this.emit('end');
})
// Should be writing sourcemaps AFTER autoprefixer runs,
// but that breaks everything right now.
.pipe(sourcemaps.write())
.pipe(autoprefixer({
browsers: ['last 3 versions', 'ie 9']
}))
.pipe(gulp.dest('./css'))
.pipe(livereload());
});
gulp.task('sass:prod', function () {
console.log('[sass]'.bold.magenta + ' Compiling production CSS');
return gulp.src('scss/*.scss')
.pipe(sass({
outputStyle: 'compressed',
sourcemap: false
}))
.on('error', function (error) {
beep();
console.error(error);
this.emit('end');
})
.pipe(autoprefixer({
browsers: ['last 3 versions', 'ie 9']
}))
.pipe(gulp.dest('./css'));
});
// Watch files for changes
gulp.task('watch', function () {
console.log('[watch]'.bold.magenta + ' Watching Sass files for changes');
livereload.listen();
gulp.watch(['scss/**/*.scss'], ['sass:dev']);
});
// Compile Sass and watch for file changes
gulp.task('dev', ['sass:dev', 'watch'], function () {
return console.log('\n[dev]'.bold.magenta + ' Ready for you to start doing things\n'.bold.green);
});
// Compile production Sass
gulp.task('build', ['sass:prod']);
// Visual Studio build tasks
//gulp.task('Debug', ['sass:dev']);
//gulp.task('Release', ['sass:prod']);