forked from mozilla/irlpodcast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
51 lines (44 loc) · 1.49 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
50
51
var del = require('del');
var gulp = require('gulp');
var hash = require('gulp-hash');
var minify = require('gulp-minify');
var sass = require('gulp-sass');
// gulp task named 'scss' that converts .scss to .css and places the .css files in static/css
gulp.task('scss', function() {
del(['static/css/**/*']);
gulp.src('src/scss/**/*.scss')
.pipe(sass({
outputStyle: 'compressed'
}))
.pipe(hash())
.pipe(gulp.dest('static/css'))
.pipe(hash.manifest('hash.json'))
.pipe(gulp.dest('data/css'));
});
gulp.task('js', function() {
del(['static/js/**/*']);
gulp.src(['src/js/**/*'])
// maybe we don't want this in local dev mode??
// https://www.npmjs.com/package/gulp-environments
.pipe(minify({
ext: {
// the extension to add to the minified files
min: '-min.js'
},
// don't minify already minified files
ignoreFiles: ['*.min.js'],
// don't copy the original, un-minified files to the destination dir
noSource: true
}))
.pipe(hash())
.pipe(gulp.dest('static/js'))
.pipe(hash.manifest('hash.json'))
.pipe(gulp.dest('data/js'));
});
gulp.task('watch', ['scss', 'js'], function() {
gulp.watch('src/scss/**/*.scss', ['scss']);
gulp.watch('src/js/**/*', ['js']);
});
// build task for pushing to stage/prod
gulp.task('build', ['scss', 'js']);
gulp.task('default', ['watch']);