-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
72 lines (69 loc) · 1.48 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
70
71
72
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var autoprefixer = require('autoprefixer');
var nano = require('gulp-cssnano');
var postcss = require('gulp-postcss');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var tempos = require('gulp-tempos');
var notify = require('gulp-notify');
var fs = require('fs');
var data = require('gulp-data');
var config = {
index: {
title: 'Jvase',
slideFlag: false // 是否显示左边菜单
},
doc: {
title: 'Documentation Jvase',
slideFlag: true
}
};
// Styles
gulp.task('styles', function() {
return sass('./src/index.scss')
.pipe(concat('jvase.css'))
.pipe(postcss([
autoprefixer({
browsers: [
'last 2 versions',
'last 2 Chrome versions',
'> 20%',
'> 20% in US',
'ie >= 9',
'Firefox >= 20',
'iOS 7'
]
})
]))
.pipe(gulp.dest('./dist'))
.pipe(rename({
suffix: '.min'
}))
.pipe(nano())
.pipe(gulp.dest('./dist'))
.pipe(notify({
message: 'Styles task complete'
})
);
});
gulp.task('doc', function() {
return gulp.src('./docs/template/*.temp')
.pipe(data((file) => {
return config[ file.relative.replace('.temp', '') ];
}))
.pipe(tempos(null, {
extname: '.html'
}))
.pipe(gulp.dest('./docs'))
.pipe(notify({
message: 'Doc task complete'
}));
});
gulp.start('doc');
gulp.task('default', function() {
gulp.start(['styles', 'doc']);
});
gulp.task('watch', function() {
gulp.watch('./src/**/*.*', ['styles']);
});