-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
39 lines (32 loc) · 965 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const browserSync = require('browser-sync').create();
const useref = require('gulp-useref');
const uglify = require('gulp-uglify');
const gulpIf = require('gulp-if');
gulp.task('sass', () => {
return gulp.src('lib/scss/app.scss')
.pipe(sass()) // Converts Sass to CSS with gulp-sass
.pipe(gulp.dest('public/css'))
.pipe(browserSync.reload({
stream: true
}));
});
gulp.task('browserSync', () => {
browserSync.init({
server: {
baseDir: 'public'
}, ui: { port: 8000 },
});
});
gulp.task('useref', function() {
return gulp.src('/public/*.html')
.pipe(useref())
.pipe(gulpIf('*.js', uglify()))
.pipe(gulp.dest('public'));
});
gulp.task('watch', ['browserSync', 'sass'], function (){
gulp.watch('public/scss/**/*.scss', ['sass']);
gulp.watch('public/*.html', browserSync.reload);
gulp.watch('public/js/**/*.js', browserSync.reload);
});