-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
41 lines (37 loc) · 1.01 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
/**
* Modules required
*/
var gulp = require('gulp');
var gutil = require('gulp-util');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var minifycss = require('gulp-minify-css');
var watch = require('gulp-watch');
/**
* Minify CSS files
*/
gulp.task('styles', function() {
return gulp
.src(['public/css/*.css', '!public/css/*.min.css'])
.pipe(minifycss())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('public/css'));
});
/**
* Minify JS files
*/
gulp.task('scripts', function() {
return gulp
.src(['public/js/*.js', '!public/js/*.min.js'])
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('public/js'));
});
/**
* Watcher
*/
gulp.task('watch', function() {
gulp.watch(['public/js/*.js', '!public/js/*.min.js'], ['scripts']);
gulp.watch(['public/css/*.css', '!public/css/*.min.css'], ['styles']);
});
gulp.task('default', ['watch']);