-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
36 lines (32 loc) · 1.02 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
var gulp = require('gulp');
var sass = require('gulp-sass')(require('sass'));
var useref = require('gulp-useref');
var cleanCss = require('gulp-clean-css');
var browserSync = require('browser-sync').create();
gulp.task('useref', function(){
return gulp.src('app/*.html')
.pipe(useref())
.pipe(gulp.dest('dist'))
});
gulp.task('sass', function()
{
return gulp.src('./app/css/*.scss')
.pipe(sass({outputStyle:'compressed'}))
.pipe(gulp.dest('dist/assets/css/'))
});
gulp.task('start', function(){
browserSync.init({
server:{
baseDir: './dist/',
middleware: function(req, res, next){
res.setHeader("Access-Control-Allow-Origin","*");
res.setHeader("Access-Control-Allow-Methods","*");
next();
}
},
cors: true
});
gulp.watch('./app/css/*.scss', gulp.series('sass'));
gulp.watch('./app/*.html', gulp.series('useref')).on('change', browserSync.reload);
});
gulp.task('default', gulp.series('start'));