update cdn to jsdelivr for public pens

This commit is contained in:
Cory LaViska
2025-10-27 12:26:17 -04:00
parent 1377ec9521
commit 79a76df934
2 changed files with 9 additions and 5 deletions

View File

@@ -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"

View File

@@ -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.
})
}
}