forked from egoist/50yin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
51 lines (44 loc) · 1.4 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
// Import Gulp
var gulp = require('gulp');
// Import funciton modules
var autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
minifycss = require('gulp-clean-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
notify = require('gulp-notify'),
rename = require('gulp-rename'),
del = require('del');
// Error handle
var plumber = require("gulp-plumber");
// Relative path
var paths = {
css: './css/',
js: './js/',
dist: './asserts/'
}
gulp.task('css', function() {
gulp.src([paths.css + '**/*.css'])
.pipe(plumber())
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(minifycss())
.pipe(concat('app.min.css'))
.pipe(gulp.dest(paths.dist));
return notify({ message: 'css compress finished' });
});
gulp.task('js', function() {
gulp.src([paths.js + 'jquery.js', paths.js + 'juicer.js', paths.js + 'q.js', paths.js + 'app.js'])
.pipe(plumber())
.pipe(jshint())
.pipe(uglify({compress: {drop_console: true}}))
.pipe(concat('app.min.js'))
.pipe(gulp.dest(paths.dist));
return notify({ message: 'js compress finished' });
});
// Watch The File Change Action And Minify It
gulp.task('watch', function() {
gulp.watch([paths.js + '*.css'], ['css']);
gulp.watch([paths.css + '*.js'], ['js']);
});
gulp.task('default', ['watch']);
gulp.task('watch:base', ['watch']);