forked from FirefoxCSS-Store/FirefoxCSS-Store.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
127 lines (84 loc) · 2.28 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const {task, src, dest, parallel, series, watch} = require('gulp')
// general
const config = require('./gulpconfig.js')
const rename = require('gulp-rename')
// html
const pug = require('gulp-pug')
// css
const sass = require('gulp-sass')(require('node-sass'))
const prefix = require('gulp-autoprefixer')
// js
const babel = require('gulp-babel')
const minify = require('gulp-minify')
// images
const cwebp = require('gulp-cwebp')
task('configText', () => {
return src(config.config.text.src)
.pipe(dest(config.config.text.dest))
})
task('configHidden', () => {
return src(config.config.hidden.src)
.pipe(rename({
prefix: '.',
extname: ''
}))
.pipe(dest(config.config.hidden.dest))
})
task('config', parallel('configText', 'configHidden'))
task('themes', () => {
return src(config.themes.src)
.pipe(dest(config.themes.dest))
})
task('pug', () => {
return src(config.pug.src)
.pipe(pug(config.pug.opts.pug))
.pipe(dest(config.pug.dest))
})
task('sass', () => {
return src(config.sass.src)
.pipe(sass(config.sass.opts.sass).on('error', sass.logError))
.pipe(prefix(config.sass.opts.autoprefixer))
.pipe(rename({extname: config.sass.ext}))
.pipe(dest(config.sass.dest))
})
task('js', () => {
return src(config.js.src)
.pipe(babel(config.js.opts.babel))
.pipe(minify({ext: {min: config.js.ext}}))
.pipe(dest(config.js.dest))
})
task('convertImages', () => {
return src(config.images.toConvert)
.pipe(cwebp())
.pipe(dest(config.images.dest))
})
task('copyImages', () => {
return src(config.images.toCopy)
.pipe(dest(config.images.dest))
})
task('copyFavicon', () => {
return src(config.images.favicon)
.pipe(dest(config.images.faviconDest))
})
task('images', parallel('convertImages', 'copyImages', 'copyFavicon'))
task('fonts', () => {
return src(config.fonts.src)
.pipe(dest(config.fonts.dest))
})
task('default', parallel(
'config',
'pug',
'sass',
'js',
'images',
'fonts',
'themes'
))
task('watchPug', () => { watch(`${config.watchSource}/pug/**/*`, series('pug')) })
task('watchSass', () => { watch(`${config.watchSource}/scss/**/*`, series('sass')) })
task('watchJS', () => { watch(`${config.watchSource}/js/**/*`, series('js')) })
task('watch', parallel(
'watchPug',
'watchSass',
'watchJS'
))