-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (38 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
37
38
39
40
41
42
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var cssnano = require('gulp-cssnano');
var runSequence = require('run-sequence');
var autoprefixer = require('gulp-autoprefixer');
var rename = require("gulp-rename");
// Live browser reloading
gulp.task('browserSync', function() {
browserSync.init({
server: {
baseDir: './'
}
})
});
// Watch
gulp.task('watch', ['browserSync'], function() {
// Refresh the browser if any HTML changes occur
gulp.watch('*.html', browserSync.reload);
});
// Minify CSS (not in use for now)
gulp.task('minify', function() {
return gulp.src('css/main.css')
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(cssnano())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('css'));
});
// And finally, build tasks
gulp.task('default', function (callback) {
runSequence(['browserSync', 'watch'],
callback
);
});