-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (48 loc) · 1.33 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var browserSync = require('browser-sync').create();
/*
* Variables
*/
// Sass Source
var scssFiles = ['./src/scss/style.scss'];
// CSS destination
var cssDest = './src/assets/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(scssFiles)
.pipe(sass(sassDevOptions).on('error', sass.logError))
.pipe(gulp.dest(cssDest))
.pipe(browserSync.stream());
});
// Task 'sassprod' - Run with command 'gulp sassprod'
gulp.task('sassprod', function() {
return gulp.src(scssFiles)
.pipe(sass(sassProdOptions).on('error', sass.logError))
.pipe(rename('style.min.css'))
.pipe(gulp.dest(cssDest));
});
// Task 'watch' - Run with command 'gulp watch'
gulp.task('watch', function() {
browserSync.init({
server: {
baseDir: "./src/"
}
});
gulp.watch(scssFiles, ['sassdev']);
gulp.watch("*.html").on("change", browserSync.reload);
});
// Default task - Run with command 'gulp'
gulp.task('default', ['sassdev', 'watch']);