-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
64 lines (60 loc) · 1.83 KB
/
gulpfile.js
File metadata and controls
64 lines (60 loc) · 1.83 KB
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
var gulp = require('gulp');
var gutil = require('gulp-util');
var changed = require('gulp-changed');
var less = require('gulp-less');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var plumber = require('gulp-plumber');
var umd = require('gulp-umd');
//var del = require('del');
/**
* 错误处理
*/
function error(event) {
gutil.beep();
gutil.log(event);
}
gulp.task('style', function () {
return gulp.src('./test/*.less')
.pipe(plumber({errorHandler: error}))
.pipe(less())
.pipe(concat('angular-wt-genius-min.css'))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('js', function () {
return gulp.src(['./src/main.js', './src/*/*.js'])
.pipe(plumber({errorHandler: error}))
.pipe(concat('angular-wt-genius.js'))
.pipe(umd({
exports: function (file) {
return 'wtGenius';
},
namespace: function (file) {
return 'wtGenius';
},
dependencies: function (file) {
return [
{
name: 'notify.js/dist/notify.js',
amd: 'notify.js/dist/notify.js',
cjs: 'notify.js/dist/notify.js',
global: 'Notify',
param: 'Notify'
}
];
}
}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('js-min', function () {
return gulp.src(['./dist/angular-wt-genius.js'])
.pipe(uglify())
.pipe(concat('angular-wt-genius-min.js'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('default', ['style', 'js', 'js-min']);