forked from bigfa/nm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·69 lines (58 loc) · 1.92 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
58
59
60
61
62
63
64
65
66
67
68
69
var gulp = require('gulp');
var less = require('gulp-less');
var uglify = require('gulp-uglifyjs');
var nano = require('gulp-cssnano');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var rename = require('gulp-rename');
var watch = require('gulp-watch');
gulp.task('less', function () {
gulp.src('static/css/single.less')
.pipe(less().on('error', function (e){
console.error(e.message);
this.emit('end');
}))
.pipe(postcss([autoprefixer]))
.pipe(nano())
.pipe(rename('single.min.css'))
.pipe(gulp.dest('build/css'))
gulp.src('static/css/page.less')
.pipe(less().on('error', function (e){
console.error(e.message);
this.emit('end');
}))
.pipe(postcss([autoprefixer]))
.pipe(nano())
.pipe(rename('page.min.css'))
.pipe(gulp.dest('build/css'))
gulp.src('static/css/setting.less')
.pipe(less().on('error', function (e){
console.error(e.message);
this.emit('end');
}))
.pipe(postcss([autoprefixer]))
.pipe(nano())
.pipe(rename('setting.min.css'))
.pipe(gulp.dest('build/css'))
});
gulp.task("uglify", function () {
gulp.src("static/js/setting.js")
.pipe(uglify())
.pipe(rename('setting.min.js'))
.pipe(gulp.dest("build/js"))
gulp.src("static/js/single.js")
.pipe(uglify())
.pipe(rename('single.min.js'))
.pipe(gulp.dest("build/js"))
gulp.src("static/js/page.js")
.pipe(uglify())
.pipe(rename('page.min.js'))
.pipe(gulp.dest("build/js"))
gulp.src("static/js/base.js")
.pipe(uglify())
.pipe(rename('base.min.js'))
.pipe(gulp.dest("build/js"))
gulp.src("static/js/vue.min.js")
.pipe(gulp.dest("build/js"))
});
gulp.task('default', ['less','uglify']);