-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
47 lines (41 loc) · 1.08 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
43
44
45
46
47
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass'),
plumber = require('gulp-plumber'),
browserSync = require('browser-sync'),
reload = browserSync.reload;
// Uglyfies js on to /js/minjs
gulp.task('scripts', function(){
gulp.src('js/*.js')
.pipe(plumber())
.pipe(uglify())
.pipe(gulp.dest("js/minjs"));
});
// Compiles sass to /css
gulp.task('sass', function () {
gulp.src('sass/**/*.scss')
.pipe(plumber())
.pipe(sass())
.pipe(gulp.dest('css'))
.pipe(reload({stream:true}));
});
// reload server
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: "./"
}
});
});
// Reload all Browsers
gulp.task('bs-reload', function () {
browserSync.reload();
});
// watch for changes on files
gulp.task('watch', function(){
gulp.watch('js/*.js', ['scripts']);
gulp.watch('sass/**/*.scss', ['sass']);
gulp.watch("*.html", ['bs-reload']);
});
// deploys
gulp.task('default', ['scripts', 'sass','browser-sync','watch']);