-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
49 lines (45 loc) · 1.21 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
48
49
// Initialize plugins
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
livereload = require('gulp-livereload')
;
// Compile SASS
gulp.task('countdown-sass', function() {
return gulp.src('src/scss/countdown.scss')
.pipe(sass({
style: 'compressed'
}))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(rename({
extname:'.min.css'
}))
.pipe(gulp.dest('dist/assets/css'))
.pipe(livereload())
;
});
gulp.watch('src/scss/countdown.scss', ['countdown-sass']);
// Minify JS
gulp.task('countdown-js', function() {
return gulp.src('src/js/countdown.js')
.pipe(uglify())
.pipe(rename({
extname:'.min.js'}
))
.pipe(gulp.dest('dist/assets/js'))
.pipe(livereload())
;
});
gulp.watch('src/js/countdown.js', ['countdown-js']);
// LiveReload page when modifying index.html
gulp.task('countdown-reload', function() {
livereload.changed();
});
gulp.watch('dist/index.html', ['countdown-reload']);
// Do all the above by default
gulp.task('default', ['countdown-sass','countdown-js']);