Skip to content

Commit c08700a

Browse files
committed
fix: minor UIkit fixes
1 parent 1ec6017 commit c08700a

File tree

6 files changed

+98
-116
lines changed

6 files changed

+98
-116
lines changed

packages/uikit-workshop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"license": "MIT",
1818
"scripts": {
1919
"preinstall": "export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1",
20-
"build": "webpack-cli --config webpack.config.js --display=minimal",
20+
"build": "webpack-cli --config webpack.config.js --display=minimal && RESULT=$(npx inline-critical -c ../../www/pattern-lab/styleguide/css/pattern-lab.css -h ../../www/pattern-lab/index.html) && echo $RESULT > ../../www/pattern-lab/index.html",
2121
"test": "npm run build -- --bail",
2222
"watch": "webpack-cli --config webpack.config.js --progress --watch"
2323
},

packages/uikit-workshop/src/html/index.html

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,9 @@
88
content="initial-scale=1, width=device-width, viewport-fit=cover"
99
/>
1010
<meta name="theme-color" content="#ababab" />
11-
<link rel="stylesheet" href="styleguide/css/pattern-lab.css" media="all" />
12-
13-
<link
14-
rel="prefetch"
15-
as="image"
16-
href="styleguide/images/pattern-lab-logo--on-dark.svg"
17-
/>
18-
<link
19-
rel="prefetch"
20-
as="image"
21-
href="styleguide/images/pattern-lab-logo--on-light.svg"
22-
/>
23-
<script src="styleguide/data/patternlab-data.js" defer></script>
24-
<script src="annotations/annotations.js" defer></script>
25-
<script
26-
src="styleguide/js/patternlab-viewer.modern.js"
27-
type="module"
28-
></script>
11+
<link rel="stylesheet" href="styleguide/css/pattern-lab.css" media="all">
12+
<link rel="prefetch" as="image" href="/images/bolt-logo--dark.svg">
13+
<link rel="prefetch" as="image" href="/images/bolt-logo--light.svg">
2914
</head>
3015

3116
<body class="pl-c-body">
@@ -36,6 +21,12 @@
3621
${require('./partials/base-template.html') }
3722
</script>
3823

24+
<script src="styleguide/data/patternlab-data.js" defer></script>
25+
<script src="annotations/annotations.js" defer></script>
26+
<script
27+
src="styleguide/js/patternlab-viewer.modern.js"
28+
type="module"
29+
></script>
3930
<script>
4031
// https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc
4132
(function() {

packages/uikit-workshop/src/scripts/lit-components/pl-viewport-size-list/pl-viewport-size-list.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ pl-viewport-sizes {
1919
overflow-x: auto;
2020
padding: 0 0.25rem;
2121

22-
.pl-c-body--theme-sidebar & {
23-
@media all and (min-width: $pl-bp-med) {
24-
padding-bottom: 0.5rem;
25-
}
26-
}
27-
2822
@media all and (min-width: $pl-bp-med) {
2923
align-items: center;
3024
-webkit-overflow-scrolling: touch;
@@ -43,6 +37,7 @@ pl-viewport-sizes {
4337
*/
4438
.pl-c-size-list__action {
4539
@include buttonStyles;
40+
display: inline-block; // workaround to fix valign issues in IE 11
4641
min-height: 35px;
4742
min-width: 0;
4843
padding-left: 0.35rem;

packages/uikit-workshop/src/scripts/lit-components/pl-viewport/pl-viewport.scss

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,26 +174,14 @@ pl-iframe {
174174
display: flex;
175175
justify-content: center;
176176
align-items: center;
177+
transition: background .3s cubic-bezier(.25,.8,.25,1)!important;
178+
cursor: ew-resize;
177179

178-
&:hover:after,
179-
&.is-resizing:after {
180+
&:hover,
181+
&.is-resizing {
180182
background-color: #F6F6F9;
181183
}
182184

183-
&:after {
184-
content: '';
185-
transition: .3s cubic-bezier(.25,.8,.25,1)!important;
186-
cursor: ew-resize;
187-
display: flex;
188-
justify-content: center;
189-
height: 100%;
190-
align-items: center;
191-
position: fixed;
192-
top: 0;
193-
bottom: 0;
194-
width: $pl-resizer-width;
195-
}
196-
197185
&:active {
198186
cursor: move;
199187
}

packages/uikit-workshop/src/scripts/patternlab-pattern.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import 'regenerator-runtime/runtime';
2+
if (window.NodeList && !NodeList.prototype.forEach) {
3+
NodeList.prototype.forEach = Array.prototype.forEach;
4+
}
25
import '@pattern-lab/uikit-polyfills/platform/custom-event';
36
import '@pattern-lab/uikit-polyfills/platform/symbol';
47
import './components/modal-styleguide';

packages/uikit-workshop/webpack.config.js

Lines changed: 80 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,6 @@ module.exports = function() {
254254
},
255255
plugins: [
256256
new CopyPlugin(config.copy),
257-
new MiniCssExtractPlugin({
258-
filename: `[name].css`,
259-
chunkFilename: `[id].css`,
260-
allChunks: true,
261-
}),
262257
new NoEmitPlugin(['css/pattern-lab.js']),
263258
],
264259
};
@@ -298,6 +293,13 @@ module.exports = function() {
298293
},
299294
],
300295
},
296+
plugins: [
297+
new MiniCssExtractPlugin({
298+
filename: `[name].css`,
299+
chunkFilename: `[id].css`,
300+
allChunks: true,
301+
}),
302+
]
301303
});
302304

303305
const modernConfig = merge(webpackConfig, {
@@ -343,86 +345,89 @@ module.exports = function() {
343345
beforeEmit: false,
344346
}
345347
),
348+
new PrerenderSPAPlugin({
349+
// Required - The path to the webpack-outputted app to prerender.
350+
// staticDir: path.join(__dirname, 'dist'),
351+
staticDir: path.resolve(process.cwd(), `${config.buildDir}/`),
352+
// Required - Routes to render.
353+
routes: ['/'],
354+
postProcess(context) {
355+
context.html = context.html.replace(
356+
/<script\s[^>]*charset=\"utf-8\"[^>]*><\/script>/gi,
357+
'',
358+
);
359+
return context;
360+
},
361+
renderer: new Renderer({
362+
// Optional - The name of the property to add to the window object with the contents of `inject`.
363+
injectProperty: '__PRERENDER_INJECTED',
364+
// Optional - Any values you'd like your app to have access to via `window.injectProperty`.
365+
inject: {
366+
foo: 'bar',
367+
},
368+
}),
369+
}),
346370
new HtmlWebpackPlugin({
347371
filename: '../index.html',
348372
template: 'src/html/index.html',
349373
inject: false,
350374
}),
375+
new MiniCssExtractPlugin({
376+
filename: `[name].css`,
377+
chunkFilename: `[id].css`,
378+
allChunks: true,
379+
}),
351380
],
352381
});
353382

354-
if (!argv.watch) {
355-
if (localChrome) {
356-
const browserPromise = puppeteer.launch({
357-
executablePath: localChrome,
358-
ignoreHTTPSErrors: true,
359-
args: ['--disable-setuid-sandbox', '--no-sandbox'],
360-
// not required to specify here, but saves Penthouse some work if you will
361-
// re-use the same viewport for most penthouse calls.
362-
defaultViewport: {
363-
width: 1300,
364-
height: 900,
365-
},
366-
});
383+
// if (localChrome) {
384+
// const browserPromise = puppeteer.launch({
385+
// executablePath: localChrome,
386+
// ignoreHTTPSErrors: true,
387+
// args: ['--disable-setuid-sandbox', '--no-sandbox'],
388+
// // not required to specify here, but saves Penthouse some work if you will
389+
// // re-use the same viewport for most penthouse calls.
390+
// defaultViewport: {
391+
// width: 1300,
392+
// height: 900,
393+
// },
394+
// });
367395

368-
modernConfig.plugins.push(
369-
new PrerenderSPAPlugin({
370-
// Required - The path to the webpack-outputted app to prerender.
371-
// staticDir: path.join(__dirname, 'dist'),
372-
staticDir: path.resolve(process.cwd(), `${config.buildDir}/`),
373-
// Required - Routes to render.
374-
routes: ['/'],
375-
postProcess(context) {
376-
context.html = context.html.replace(
377-
/<script\s[^>]*charset=\"utf-8\"[^>]*><\/script>/gi,
378-
'',
379-
);
380-
return context;
381-
},
382-
renderer: new Renderer({
383-
// Optional - The name of the property to add to the window object with the contents of `inject`.
384-
injectProperty: '__PRERENDER_INJECTED',
385-
// Optional - Any values you'd like your app to have access to via `window.injectProperty`.
386-
inject: {
387-
foo: 'bar',
388-
},
389-
}),
390-
}),
391-
new CriticalCssPlugin({
392-
base: path.resolve(__dirname, config.buildDir),
393-
src: 'index.html',
394-
dest: 'index.html',
395-
inline: true,
396-
minify: true,
397-
extract: false,
398-
width: 1300,
399-
height: 900,
400-
penthouse: {
401-
keepLargerMediaQueries: true,
396+
// modernConfig.plugins.push(
397+
// new CriticalCssPlugin({
398+
// base: path.resolve(__dirname, config.buildDir),
399+
// src: 'index.html',
400+
// dest: 'index.html',
401+
// inline: true,
402+
// minify: true,
403+
// extract: false,
404+
// width: 1300,
405+
// height: 900,
406+
// penthouse: {
407+
// keepLargerMediaQueries: true,
402408

403-
// @todo: troubleshoot why forceInclude works w/ Penthouse directly but not w/ Critical
404-
forceInclude: [
405-
'pl-logo',
406-
'.pl-c-logo',
407-
'.pl-c-logo__img',
408-
'.pl-c-body--theme-light',
409-
'.pl-c-body--theme-sidebar',
410-
'.pl-c-body--theme-sidebar .pl-c-viewport',
411-
'.pl-c-body--theme-density-compact',
412-
],
413-
timeout: 30000, // ms; abort critical CSS generation after this timeout
414-
maxEmbeddedBase64Length: 1000,
415-
renderWaitTime: 1000,
416-
blockJSRequests: false,
417-
puppeteer: {
418-
executablePath: localChrome,
419-
getBrowser: () => browserPromise
420-
}
421-
},
422-
})
423-
);
424-
}
425-
}
409+
// // @todo: troubleshoot why forceInclude works w/ Penthouse directly but not w/ Critical
410+
// forceInclude: [
411+
// 'pl-logo',
412+
// '.pl-c-logo',
413+
// '.pl-c-logo__img',
414+
// '.pl-c-body--theme-light',
415+
// '.pl-c-body--theme-sidebar',
416+
// '.pl-c-body--theme-sidebar .pl-c-viewport',
417+
// '.pl-c-body--theme-density-compact',
418+
// ],
419+
// timeout: 30000, // ms; abort critical CSS generation after this timeout
420+
// maxEmbeddedBase64Length: 1000,
421+
// renderWaitTime: 1000,
422+
// blockJSRequests: false,
423+
// puppeteer: {
424+
// executablePath: localChrome,
425+
// getBrowser: () => browserPromise
426+
// }
427+
// },
428+
// })
429+
// );
430+
// }
426431

427432
return resolve([modernConfig, legacyConfig]);
428433
});

0 commit comments

Comments
 (0)