-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
48 lines (40 loc) · 1.07 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
/*
* Variables
*/
// CSS destination
var cssDest = './css';
// Options for development
var sassDevOptions = {
outputStyle: 'expanded'
}
// Options for production
var sassProdOptions = {
outputStyle: 'compressed'
}
/*
* Tasks
*/
// Task 'sassdev' - Run with command 'gulp sassdev'
gulp.task('sassdev', function() {
return gulp.src("./src/scss/*.scss")
.pipe(sass(sassDevOptions).on('error', sass.logError))
.pipe(gulp.dest(cssDest));
});
// Task 'sassprod' - Run with command 'gulp sassprod'
gulp.task('sassprod', function() {
return gulp.src("./src/scss/*.scss")
.pipe(sass(sassProdOptions).on('error', sass.logError))
.pipe(rename(function (path) {
path.basename += ".min";
}))
.pipe(gulp.dest(cssDest));
});
// Task 'watch' - Run with command 'gulp watch'
gulp.task('watch', function() {
gulp.watch("./src/scss/*.scss", ['sassdev', 'sassprod']);
});
// Default task - Run with command 'gulp'
gulp.task('default', ['sassdev', 'sassprod', 'watch']);