-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
51 lines (38 loc) · 1.29 KB
/
gulpfile.js
File metadata and controls
51 lines (38 loc) · 1.29 KB
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
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
//-------tasks---------------------------------------
//1.sass to css conversion task
gulp.task('sass', function(){
//the"return here means we want to run this first
return gulp.src('sass/*.sass')
.pipe(sass())//using gulp-sass
.pipe(gulp.dest('css'))
.pipe(browserSync.reload({
stream: true
}))
});
//2.browser sync task
gulp.task('browserSync', function(){
browserSync.init({
server: {
//default root folder
baseDir:'./'
},
})
});
//-------watch---------------------------------------
//watch all file conversion tasks - usuallly in app folder
//making sure ]browser sync & sass] already runs before running watch
gulp.task('watch', ['browserSync','sass'], function(){
//watch for sass conversions
gulp.watch('sass/*.sass',['sass']);
//other watches
//reload the browser whenever index.html files change
gulp.watch('*.html').on('change', browserSync.reload);
//reload all html files in html folder
gulp.watch('html/*.html').on('change', browserSync.reload);
//gulp.watch('app/*.js', browserSync.reload);
});
//-------deployment-------------------------------------
// gulp.task('default', ['sass', 'image', 'prefix','indexhtmlmin','allhtmlmin','uglify']);