-
Notifications
You must be signed in to change notification settings - Fork 103
/
gulpfile.js
46 lines (38 loc) · 1.04 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
'use strict';
var gulp = require('gulp');
var gulpSass = require('gulp-sass');
var gulpAutoPrefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
gulpSass.compiler = require('node-sass');
function sass(env) {
var nodeSassOption = {
outputStyle: 'expanded',
sourceComments: env === 'development'
};
// sourceComments
return gulp.src('./sass/*.scss')
.pipe(gulpSass(nodeSassOption).on('error', gulpSass.logError))
.pipe(gulpAutoPrefixer({
cascade: true
}))
.pipe(gulp.dest('stylesheets'))
.pipe(browserSync.stream())
;
}
gulp.task('sass:prod', function () {
return sass('production');
});
gulp.task('sass:dev', function () {
return sass('development');
});
gulp.task('browser-sync', function (done) {
browserSync.init({
port: 3001,
proxy: '127.0.0.1:3000'
});
done();
});
gulp.task('debug', gulp.series('sass:dev', 'browser-sync', function () {
gulp.watch('sass/**/*.scss', gulp.task('sass:dev'));
}));
gulp.task('default', gulp.series('sass:prod'));