OSDN Git Service

Regular updates
[twpd/master.git] / _support / critical.js
1 const critical = require('critical')
2
3 console.warn('Generating critical path styles into _includes/2017/critical/...')
4
5 const OPTIONS = {
6   base: '_site',
7   width: 1400,
8   height: 900,
9   minify: true,
10   extract: true,
11   ignore: [
12     '@font-face'
13   ],
14   include: [
15     // fade-in magic (base/fade)
16     /html\.WithJs/
17   ]
18 }
19
20 critical.generate({
21   ...OPTIONS,
22   src: 'index.html',
23   dest: '../_includes/2017/critical/home.css',
24   include: [
25     ...OPTIONS.include,
26
27     // searchbox with placeholder
28     /\.search-box/
29   ]
30 })
31
32 critical.generate({
33   ...OPTIONS,
34   src: 'react.html',
35   dest: '../_includes/2017/critical/sheet.css',
36   include: [
37     ...OPTIONS.include,
38
39     // sections (and h3 section list), just to be sure
40     /\.h3-section/,
41
42     // eg, -six-column in devhints.io/layout-thrashing
43     /-column/
44   ]
45 })