-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
44 lines (37 loc) · 1010 Bytes
/
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
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
// concatenate
var useref = require('gulp-useref');
var uglify = require('gulp-uglify');
var gulpIf = require('gulp-if');
// minify
var cssnano = require('gulp-cssnano');
// run tasks in order
var runSequence = require('run-sequence');
gulp.task('sass', function(){
return gulp.src('developement/style/*.scss')
.pipe(sass())
.pipe(gulp.dest('style'));
});
gulp.task('browserSync', function() {
browserSync.init({
server: {
baseDir: './'
},
});
});
gulp.task('useref', function() {
return gulp.src('developement/*.html')
.pipe(useref())
.pipe(gulpIf('*.css', cssnano()))
.pipe(gulp.dest('./'));
});
gulp.task('build', function(callback) {
runSequence('sass','useref', 'watch', callback);
});
gulp.task('watch', function() {
gulp.watch('developement/style/*.scss', ['build']);
gulp.watch('developement/*.html', ['build']);
});
gulp.task('default',['watch','browserSync']);