This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 140
/
gulpfile.js
76 lines (68 loc) · 1.56 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
73
74
75
76
'use strict'
const gulp = require('gulp')
const postcss = require('gulp-postcss')
const jade = require('gulp-jade')
const serve = require('gulp-serve')
const pkg = require('./package')
const paths = {
css: {
entry: [
'./src/css/hack.css',
'./src/css/themes/*.css'
],
all: './src/css/**/*.css'
},
html: {
entry: ['./src/html/*.jade'],
all: './src/html/**/*.jade'
},
static: {
entry: ['./src/static/*'],
all: './src/static/*'
}
}
gulp.task('serve', serve({
host: '127.0.0.1',
port: 4001,
root: './demo'
}))
gulp.task('css', () => {
gulp.src(paths.css.entry)
.pipe(postcss([
require('postcss-import')(),
require('postcss-mixins'),
require('postcss-simple-vars'),
require('postcss-cssnext')({
browsers: ['last 2 versions', 'ie > 8']
}),
require('cssnano')({
autoprefixer: false
})
]))
.pipe(gulp.dest('./dist'))
.pipe(gulp.dest('./demo'))
})
gulp.task('html', () => {
const d = new Date()
gulp.src(paths.html.entry)
.pipe(jade({
pretty: true,
locals: {
time: Date.now(),
version: pkg.version,
build: Math.floor(Date.now() / 1000)
}
}))
.pipe(gulp.dest('./demo'))
})
gulp.task('static', () => {
gulp.src(paths.static.entry)
.pipe(gulp.dest('./demo'))
})
gulp.task('watch', () => {
gulp.watch(paths.css.all, ['css'])
gulp.watch(paths.html.all, ['html'])
gulp.watch(paths.static.all, ['static'])
})
gulp.task('build', ['css', 'html', 'static'])
gulp.task('default', ['build', 'watch', 'serve'])