-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
43 lines (36 loc) · 1.05 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
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var minifyCSS = require('gulp-minify-css');
var rename = require("gulp-rename");
var connect = require('gulp-connect');
var livereload = require('gulp-livereload');
var css_dir = ['./css/*.css', '!./css/*min.css']//, './**/css/*.css', '!./**/css/*min.css'];
var js_dir = ['./js/*.js', '!./js/*min.js']//, './**/js/*.js', '!./**/js/*min.js'];
gulp.task('scripts', function() {
gulp.src(js_dir)
.pipe(uglify())
.pipe(rename({suffix: ".min"}))
.pipe(gulp.dest(function(file) {
return file.base;
}));
});
gulp.task('minify-css', function() {
return gulp.src(css_dir)
.pipe(minifyCSS())
.pipe(rename({suffix: ".min"}))
.pipe(gulp.dest(function(file) {
return file.base;
}));
});
gulp.task('watch', function () {
gulp.watch('./js/*js', ['scripts']);
gulp.watch('./css/*css', ['minify-css']);
});
gulp.task('server', function () {
connect.server({
root: './',
livereload: true,
port: 8000
});
})
gulp.task('default', ['scripts', 'minify-css', 'watch', 'server']);