-
Notifications
You must be signed in to change notification settings - Fork 8
/
config.js
99 lines (93 loc) · 2.14 KB
/
config.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
const fs = require( 'fs' );
// PATH for folder/files - relative to gulpfile.js
const paths = {
scss: 'assets/scss/',
css: 'assets/css/',
scripts: 'assets/js/',
html: '',
domain: 'yourdomain' // your local domain, e.g. http://local.mysite; required for local development (browserSync) and for generate critical CSS
}
// browserSync
const sync = {
server: {
files: [ '{template-parts}/**/*.php', '*.php' ],
proxy: paths.domain,
host: paths.domain,
port: 4000,
open: false,
snippetOptions: {
whitelist: [ '/wp-admin/admin-ajax.php' ],
blacklist: [ '/wp-admin/**' ]
}
}
}
// autoprefixer
const settingsAutoprefixer = {
browsers: [ 'last 2 versions' ]
}
// critical css
const sourceCssForCritical = [];//array of css files which used for create critical css
const mainCssFile = 'assets/css/starter.css';//main css file
const advancedWooSearch = '../../plugins/advanced-woo-search/assets/css/common.css';//search css plugin's file
sourceCssForCritical.push( mainCssFile );
if ( fs.existsSync( advancedWooSearch ) ) {//add search file if plugin exist
sourceCssForCritical.push( advancedWooSearch );
}
const critical = {
base: 'assets/',
ignore: [ '@font-face',/url\(/ ],
css: sourceCssForCritical,
penthouse: {
timeout: 1000000000,
renderWaitTime: 500
},
dimensions: [{
height: 812,
width: 375
}, {
height: 5000,
width: 5000
}]
}
// pairs URL of page - template name
const criticalSrcPages = [
{
url: paths.domain + '/sample-page',
css: 'css/critical/page.css'
},
{
url: paths.domain + '/support/',
css: 'css/critical/page-support.css'
},
{
url: paths.domain,
css: 'css/critical/page-home.css'
},
{
url: paths.domain,
css: 'css/critical/index.css'
},
{
url: paths.domain,
css: 'css/critical/404.css'
},
{
url: paths.domain + '/shop/',
css: 'css/critical/archive-product.css'
},
{
url: paths.domain + '/product/beanie/',
css: 'css/critical/single-product.css'
},
{
url: paths.domain + '/shop/',
css: 'css/critical/taxonomy-product-cat.css'
}
]
module.exports = {
paths: paths,
sync: sync,
settingsAutoprefixer: settingsAutoprefixer,
critical: critical,
criticalSrcPages, criticalSrcPages
}