-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·55 lines (47 loc) · 1.27 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'),
plumber = require('gulp-plumber'),
notify = require('gulp-notify'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
browserSync = require('browser-sync');
var path = {
'src': 'src/',
'dist': 'dist/',
'start': 'index.html'
}
//====================
// SASS
//====================
gulp.task('sass', function(){
return gulp.src(path.src + '/**/!(_)*.scss')
.pipe(plumber({errorHandler: notify.onError('<%= error.message %>')}))
.pipe(sass({outputStyle: 'expanded'})) // compressed | expanded
.pipe(rename({extname: '.css'}))
.pipe(gulp.dest(path.dist))
.pipe(sass({outputStyle: 'compressed'}))
.pipe(rename({suffix: '.min' }))
.pipe(gulp.dest(path.dist))
});
//====================
// Reload
//====================
gulp.task('browser-sync', function() {
browserSync.init({
port: 3010,
server: {
baseDir: "dist",
index: path.start
}
});
});
gulp.task('reload', function(){
browserSync.reload();
});
//====================
// Watch
//====================
gulp.task('default', ['browser-sync'], function(){
gulp.watch([path.src + '/**/*.scss'], ['sass']);
gulp.watch([path.dist + '/**/*.html'], ['reload']);
gulp.watch([path.dist + '/**/*.css'], ['reload']);
});