-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
44 lines (33 loc) · 1012 Bytes
/
gulpfile.babel.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
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const cleancss = require('gulp-clean-css');
const rename = require('gulp-rename');
const paths = {
javascripts: [
'static/javascripts/*.js',
'!static/javascripts/*.min.js'
],
stylesheets: [
'static/stylesheets/*.css',
'!static/stylesheets/*.min.css'
]
};
const buildDirectory = 'static';
gulp.task('buildcss', _ => {
return gulp.src(paths.stylesheets, { base: 'static' })
.pipe(cleancss())
.pipe(rename(path => path.extname = '.min.css'))
.pipe(gulp.dest(buildDirectory));
});
gulp.task('buildjs', _ => {
return gulp.src(paths.javascripts, { base: 'static' })
.pipe(uglify())
.pipe(rename(path => path.extname = '.min.js'))
.pipe(gulp.dest(buildDirectory));
});
gulp.task('build', ['buildcss', 'buildjs']);
gulp.task('watch', _ => {
gulp.watch(paths.stylesheets, ['buildcss']);
gulp.watch(paths.javascripts, ['buildjs']);
});
gulp.task('default', ['buildcss', 'buildjs', 'watch']);