-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
62 lines (52 loc) · 1.51 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
const gulp = require('gulp')
const pug = require("gulp-pug")
const stylus = require('gulp-stylus')
const connect = require('gulp-connect')
const coffee = require('gulp-coffee')
const autoprefixer = require('gulp-autoprefixer');
gulp.task('build', function() {
gulp.src([
'node_modules/jquery/dist/jquery.min.js',
'node_modules/echarts/dist/echarts.min.js',
'node_modules/handlebars/dist/handlebars.min.js',
'node_modules/clipboard/dist/clipboard.min.js',
'node_modules/flatpickr/dist/flatpickr.min.js',
'node_modules/flatpickr/dist/flatpickr.min.css',
]).pipe(gulp.dest('dist/lib'))
gulp.src([
'node_modules/flatpickr/dist/l10n/zh.js'
]).pipe(gulp.dest('dist/lib/l10n'))
gulp.src([
'node_modules/flatpickr/dist/themes/airbnb.css'
]).pipe(gulp.dest('dist/lib/themes'))
gulp.src('src/tpl/*.pug')
.pipe(pug({pretty: true}))
.pipe(gulp.dest('dist'))
.pipe(connect.reload())
gulp.src('src/img/*')
.pipe(gulp.dest('dist/img'))
.pipe(connect.reload())
gulp.src('src/css/*')
.pipe(stylus())
.pipe(autoprefixer({
browsers: ['last 2 versions', '> 1%'],
cascade: false
}))
.pipe(gulp.dest('dist/css'))
.pipe(connect.reload())
gulp.src('src/js/*')
.pipe(coffee())
.pipe(gulp.dest('dist/js'))
.pipe(connect.reload())
})
gulp.task('connect', function() {
connect.server({
root: 'dist',
port: 8888,
livereload: true
})
})
gulp.task('watch', function(){
gulp.watch('src/**', ['build'])
})
gulp.task('dev', ['connect', 'watch'])