-
Notifications
You must be signed in to change notification settings - Fork 14
/
gulpfile.js
57 lines (46 loc) · 1.22 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'),
$ = require('gulp-load-plugins')();
//watch
gulp.task('watch', ['default'], function() {
gulp.watch('lib/**/*', ['default']);
});
//default
gulp.task('default', function() {
gulp.start('styles', 'js', 'html');
});
//////////////////
//styles
gulp.task('styles', function() {
//less & css
return gulp.src(['lib/styles/*.less', 'lib/styles/*.css'])
//.pipe($.sourcemaps.init())
.pipe($.concat('style.css'))
.pipe($.less())
.pipe($.autoprefixer({
browsers: ['> 5% in CN']
}))
//.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest('docs'));
});
//js
gulp.task('js', function() {
return gulp.src('lib/js/*.js')
.pipe($.sourcemaps.init())
.pipe($.babel({
presets: ['es2015']
}))
.pipe($.concat('main.js'))
.pipe($.uglify())
.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest('docs'));
});
//html
gulp.task('html', ['styles'], function() {
return gulp.src('lib/i.html')
.pipe($.inlineSource({rootpath:'docs'}))
.pipe($.htmlmin({
collapseWhitespace: true,
sortAttributes: true
}))
.pipe(gulp.dest('docs'));
});