-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcritcal.js
executable file
·44 lines (33 loc) · 1017 Bytes
/
critcal.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
var critical = require('critical');
critical.generate({
// Inline the generated critical-path CSS
// - true generates HTML
// - false generates CSS
inline: true,
// Your base directory
base: 'dist/',
// HTML source
html: '<html>...</html>',
// HTML source file
src: 'index.html',
// Your CSS Files (optional)
css: ['dist/assets/maincss.5.3919a4ba95d386d0b070.css'],
// Viewport width
width: 1300,
// Viewport height
height: 900,
// Output results to file
target: {css: 'critical.css', html: 'index-critical.html', uncritical: 'uncritical.css'},
// Minify critical-path CSS when inlining
minify: true,
// Extract inlined styles from referenced stylesheets
extract: true,
// Complete Timeout for Operation
timeout: 30000,
// ignore CSS rules
ignore: {
atrule: ['@font-face'],
rule: [/some-regexp/],
decl: (node, value) => /big-image\.png/.test(value),
},
});