Skip to content

Commit ba66f49

Browse files
authored
Inline CSS fixes (#908)
* bumping version * fixing critters bug and upgrading critters * fixing tests and silencing critters * fixing critters options * removing unwanted changes * updating critters
1 parent bf7bccf commit ba66f49

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

packages/cli/lib/lib/webpack/webpack-client-config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,13 @@ function isProd(config) {
283283
}
284284

285285
if (config['inline-css']) {
286-
prodConfig.plugins.push(new CrittersPlugin());
286+
prodConfig.plugins.push(
287+
new CrittersPlugin({
288+
pruneSource: false,
289+
logLevel: 'silent',
290+
additionalStylesheets: ['*.css'],
291+
})
292+
);
287293
}
288294

289295
if (config.analyze) {

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "preact-cli",
3-
"version": "3.0.0-rc.5",
3+
"version": "3.0.0-rc.6",
44
"description": "Start building a Preact Progressive Web App in seconds.",
55
"repository": "developit/preact-cli",
66
"main": "lib/index.js",
@@ -86,7 +86,7 @@
8686
"compression-webpack-plugin": "^3.0.0",
8787
"console-clear": "^1.0.0",
8888
"copy-webpack-plugin": "^5.0.4",
89-
"critters-webpack-plugin": "^1.3.3",
89+
"critters-webpack-plugin": "^2.5.0",
9090
"cross-spawn-promise": "^0.10.1",
9191
"css-loader": "^3.1.0",
9292
"ejs-loader": "^0.3.3",

packages/cli/tests/images/build.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ exports.prerender.heads.home = `
4747
<meta name="mobile-web-app-capable" content="yes">
4848
<meta name="apple-mobile-web-app-capable" content="yes">
4949
<link rel="manifest" href="\\/manifest\\.json">
50+
<style>html{padding:0}<\\/style>
5051
<link href=\\"/bundle.\\w{5}.css\\" rel=\\"preload\\" as=\\"style\\">
51-
<style>html{padding:0;}<\\/style>
5252
<\\/head>
5353
`;
5454

@@ -60,8 +60,8 @@ exports.prerender.heads.route66 = `
6060
<meta name="mobile-web-app-capable" content="yes">
6161
<meta name="apple-mobile-web-app-capable" content="yes">
6262
<link rel="manifest" href="\\/manifest\\.json">
63+
<style>html{padding:0}<\\/style>
6364
<link href=\\"/bundle.\\w{5}.css\\" rel=\\"preload\\" as=\\"style\\">
64-
<style>html{padding:0;}<\\/style>
6565
<\\/head>
6666
`;
6767

@@ -73,8 +73,8 @@ exports.prerender.heads.custom = `
7373
<meta name="mobile-web-app-capable" content="yes">
7474
<meta name="apple-mobile-web-app-capable" content="yes">
7575
<link rel="manifest" href="\\/manifest\\.json">
76+
<style>html{padding:0}<\\/style>
7677
<link href=\\"/bundle.\\w{5}.css\\" rel=\\"preload\\" as=\\"style\\">
77-
<style>html{padding:0;}<\\/style>
7878
<\\/head>
7979
`;
8080

@@ -92,8 +92,8 @@ exports.preload.head = `
9292
<link rel=\\"preload\\" href=\\"\\/route-home\\.chunk\\.\\w{5}\\.js\\" as=\\"script\\">
9393
<link rel=\\"preload\\" href=\\"\\/route-home\\~route-route66\\~route-route89\\.chunk\\.\\w{5}\\.js\\" as=\\"script\\">
9494
<link rel=\\"preload\\" href=\\"\\/route-home\\.chunk\\.\\w{5}\\.css\\" as=\\"style\\">
95+
<style>html{padding:0}<\\/style>
9596
<link href=\\"\\/bundle\\.\\w{5}\\.css\\" rel=\\"preload\\" as=\\"style\\">
96-
<style>html{padding:0;}<\\/style>
9797
</head>
9898
`;
9999

packages/cli/tests/images/create.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ exports.default = [
2525
'src/template.html',
2626
'tests/__mocks__/browserMocks.js',
2727
'tests/__mocks__/fileMocks.js',
28+
'tests/__mocks__/setupTests.js',
2829
'tests/header.test.js',
2930
]
3031
.map(s => s.replace(/\//g, path.sep))

yarn.lock

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3793,16 +3793,19 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
37933793
safe-buffer "^5.0.1"
37943794
sha.js "^2.4.8"
37953795

3796-
critters-webpack-plugin@^1.3.3:
3797-
version "1.3.3"
3798-
resolved "https://registry.yarnpkg.com/critters-webpack-plugin/-/critters-webpack-plugin-1.3.3.tgz#e52a70042eecc81ea1201f947ef8b65b271bc71f"
3799-
integrity sha512-F/QVsqA7EI8y53DdBm2dcgRZBM5JYQ7NTZzgwr3a1q3GsaoZCO7HhmYsiU5OvagZgLHZ0ZfsctkThBY7gJ9JxQ==
3796+
critters-webpack-plugin@^2.4.0:
3797+
version "2.4.0"
3798+
resolved "https://registry.yarnpkg.com/critters-webpack-plugin/-/critters-webpack-plugin-2.4.0.tgz#ebf534a261bee5ca127e1fe321d49011d2431fb7"
3799+
integrity sha512-CFzD4g693aEzmtCE3IORvqk5FwvSofBscaQkVQvXWuStwhSuNsFMG2xrrxCghy8L1Pt6t2CG3G/tIPaiYD1WQw==
38003800
dependencies:
38013801
css "^2.2.1"
3802+
cssnano "^4.1.7"
38023803
jsdom "^12.0.0"
38033804
parse5 "^4.0.0"
3805+
postcss "^7.0.5"
38043806
pretty-bytes "^4.0.2"
3805-
webpack-sources "^1.1.0"
3807+
webpack-log "^2.0.0"
3808+
webpack-sources "^1.3.0"
38063809

38073810
cross-spawn-promise@^0.10.1:
38083811
version "0.10.1"
@@ -4021,7 +4024,7 @@ cssnano-util-same-parent@^4.0.0:
40214024
resolved "https://registry.yarnpkg.com/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz#574082fb2859d2db433855835d9a8456ea18bbf3"
40224025
integrity sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q==
40234026

4024-
cssnano@^4.1.10:
4027+
cssnano@^4.1.10, cssnano@^4.1.7:
40254028
version "4.1.10"
40264029
resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-4.1.10.tgz#0ac41f0b13d13d465487e111b778d42da631b8b2"
40274030
integrity sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFFAqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ==

0 commit comments

Comments
 (0)