mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
Update CodePen CDN (#1658)
* update path * update cdn to jsdelivr for public pens
This commit is contained in:
@@ -227,7 +227,11 @@ export default async function (eleventyConfig) {
|
||||
|
||||
// Shortcodes - {% shortCode arg1, arg2 %}
|
||||
eleventyConfig.addShortcode('cdnUrl', location => {
|
||||
return `https://early.webawesome.com/webawesome@${packageData.version}/dist/` + (location || '').replace(/^\//, '');
|
||||
// We use WA (free) via the public CDN for CodePen examples
|
||||
return (
|
||||
`https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@${packageData.version}/dist-cdn/` +
|
||||
(location || '').replace(/^\//, '')
|
||||
);
|
||||
});
|
||||
|
||||
// Turns `{% server "foo" %} into `{{ server.foo | safe }}` when the WEBAWESOME_SERVER variable is set to "true"
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
<link rel="stylesheet" href="/dist/styles/webawesome.css" />
|
||||
|
||||
<script type="module">
|
||||
document.addEventListener("wa-discovery-complete", loadLayout)
|
||||
document.addEventListener('wa-discovery-complete', loadLayout)
|
||||
function loadLayout () {
|
||||
if (!customElements.get("wa-layout")) {
|
||||
import("{% cdnUrl 'components/page/page.js' %}")
|
||||
if (!customElements.get('wa-page')) {
|
||||
import('https://early.webawesome.com/webawesome@3.0.0-beta.6/dist/components/page/page.js')
|
||||
.catch((e) => {
|
||||
// known errors with dual registration. This is only a thing in the free repo.
|
||||
// known errors with dual registration. This is only a thing in the free repo.
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ SSR in Web Awesome is experimental! There are some known bugs and timing issues.
|
||||
If you're using the `webawesome.loader.js` file which automatically loads, make sure to change it to `webawesome.ssr-loader.js`.
|
||||
|
||||
```diff
|
||||
- <script type="module" src="https://early.webawesome.com/webawesome@3.0.0-alpha.2/dist/webawesome.loader.js"></script>
|
||||
+ <script type="module" src="https://early.webawesome.com/webawesome@3.0.0-alpha.2/dist/webawesome.ssr-loader.js"></script>
|
||||
- <script type="module" src="/dist/webawesome.loader.js"></script>
|
||||
+ <script type="module" src="/dist/webawesome.ssr-loader.js"></script>
|
||||
```
|
||||
|
||||
If you're using a bundler, make sure it comes _before_ any components are imported.
|
||||
@@ -43,7 +43,10 @@ import litPlugin from '@lit-labs/eleventy-plugin-lit';
|
||||
|
||||
eleventyConfig.addPlugin(litPlugin, {
|
||||
mode: 'worker',
|
||||
componentModules: ['@awesome.me/webawesome/dist/components/button/button.js', '@awesome.me/webawesome/dist/components/input/input.js'],
|
||||
componentModules: [
|
||||
'@awesome.me/webawesome/dist/components/button/button.js',
|
||||
'@awesome.me/webawesome/dist/components/input/input.js',
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
@@ -114,4 +117,4 @@ Here are some known issues and things we're still working on.
|
||||
- `@shoelace-style/localize` (our localization library) has no way to set a language currently so it always falls back to `en`.
|
||||
- `<wa-icon>` has no fallback if there's no JS besides a blank `<svg>`. There's perhaps some backend mechanisms we can use to fetch. But requires altering APIs. Should also have a way to set height / widths, but we don't want to increase pain for SSR users.
|
||||
- `<wa-qr-code>` QR Code will not error on the backend and will render a blank canvas at the appropriate size, but will not render the canvas until the client component connects.
|
||||
- `setBasePath` and `kit codes` may need reconfiguring to work with SSR.
|
||||
- `setBasePath` and `kit codes` may need reconfiguring to work with SSR.
|
||||
|
||||
Reference in New Issue
Block a user