forked from postcss/benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
36 lines (30 loc) · 966 Bytes
/
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
let { existsSync, outputFile, remove } = require('fs-extra')
let { join } = require('path')
let gulp = require('gulp')
// Benchmark
gulp.task('clean', done => {
remove(join(__dirname, 'cache'), done)
})
gulp.task('bootstrap', done => {
let cache = join(__dirname, 'cache', 'bootstrap.css')
if (existsSync(cache)) {
done()
return
}
let load = require('load-resources')
load('github:twbs/bootstrap:dist/css/bootstrap.css', '.css', css => {
outputFile(cache, css, done)
})
});
['preprocessors', 'parsers', 'prefixers', 'tokenizers'].forEach(name => {
gulp.task(name, gulp.series('bootstrap', () => {
let bench = require('gulp-bench')
let summary = require('gulp-bench-summary')
return gulp.src(`./${ name }.js`, { read: false })
.pipe(bench())
.pipe(summary(name === 'prefixers' ? 'Autoprefixer' : 'PostCSS'))
}))
})
gulp.task('default',
gulp.series('preprocessors', 'parsers', 'prefixers', 'tokenizers')
)