-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
57 lines (48 loc) · 1.43 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
52
53
54
55
56
57
var gulp = require('gulp');
var minifycss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var plumber = require('gulp-plumber');
var less = require('gulp-less');
var path = require('path');
var gutil = require('gulp-util');
var rename = require('gulp-rename');
var path = {
'css':['./assets/css/**/*.css','!./assets/css/**/*.min.css'],
'js':['./assets/js/**/*.js','!./assets/js/lib/*.js']
};
gulp.task('less', function () {
return gulp.src('./assets/less/style.less')
.pipe(plumber(function(error) {
gutil.log(gutil.colors.red(error.message));
gutil.beep();
this.emit('end');
}))
.pipe(less())
// .pipe(minifycss())
.pipe(gulp.dest('./assets/css/'));
});
gulp.task('minifycss',function(){
return gulp.src(path['css'])
.pipe(plumber())
.pipe(minifycss())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./assets/css/'));
});
gulp.task('uglifyjs',function(){
return gulp.src(path['js'])
.pipe(plumber())
.pipe(uglify({mangle:false}))
.pipe(gulp.dest('./assets/dist/'));
});
gulp.task('watch',function(){
gulp.watch('./assets/less/**/*.less', function(){
gulp.run('less');
gulp.run('minifycss');
});
//gulp.watch(path['js'],function(){
// gulp.run('uglifyjs');
//});
});
gulp.task('default',['watch','uglifyjs','minifycss']);