mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
fix loader filename
This commit is contained in:
@@ -28,7 +28,7 @@ The autoloader is the easiest way to use Web Awesome. A lightweight script watch
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'themes/default.css' %}" />
|
||||
<script type="module" src="{% cdnUrl 'autoloader.js' %}"></script>
|
||||
<script type="module" src="{% cdnUrl 'webawesome.loader.js' %}"></script>
|
||||
```
|
||||
|
||||
Now you can [start using Web Awesome!](/getting-started/usage)
|
||||
@@ -39,7 +39,7 @@ While convenient, autoloading may lead to a [Flash of Undefined Custom Elements]
|
||||
|
||||
## Setting the Base Path
|
||||
|
||||
Some components rely on assets (icons, images, etc.) and Web Awesome needs to know where they're located. For convenience, Web Awesome will try to auto-detect the correct location based on the script you've loaded it from. This assumes assets are colocated with `autoloader.js` and will "just work" for most users.
|
||||
Some components rely on assets (icons, images, etc.) and Web Awesome needs to know where they're located. For convenience, Web Awesome will try to auto-detect the correct location based on the script you've loaded it from. This assumes assets are colocated with `webawesome.loader.js` and will "just work" for most users.
|
||||
|
||||
==If you're using the CDN, you can skip this section.== However, if you're [cherry picking](#cherry-picking) or bundling Web Awesome, you'll need to set the base path. You can do this one of two ways.
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ export function setBasePath(path: string) {
|
||||
* Gets the library's base path.
|
||||
*
|
||||
* The base path is used to load assets such as icons and images, so it needs to be set for components to work properly.
|
||||
* By default, this script will look for a script ending in webawesome.js or autoloader.js and set the base path to the
|
||||
* directory that contains that file. To override this behavior, you can add the data-webawesome attribute to any
|
||||
* By default, this script will look for a script ending in webawesome.js or webawesome.loader.js and set the base path
|
||||
* to the directory that contains that file. To override this behavior, you can add the data-webawesome attribute to any
|
||||
* element on the page to point to a local path or a CORS-enabled endpoint, such as a CDN.
|
||||
*
|
||||
* <script src="bundle.js" data-webawesome="/custom/base/path"></script>
|
||||
@@ -29,7 +29,7 @@ export function getBasePath(subpath = '') {
|
||||
// Use the data-webawesome attribute
|
||||
setBasePath(el.getAttribute('data-webawesome') || '');
|
||||
} else {
|
||||
// Look for webawesome.js or autoloader.js
|
||||
// Look for webawesome.js or webawesome.loader.js
|
||||
const scripts = [...document.getElementsByTagName('script')] as HTMLScriptElement[];
|
||||
const waScript = scripts.find(
|
||||
script => script.src.endsWith('webawesome.js') || script.src.endsWith('webawesome.loader.js')
|
||||
|
||||
Reference in New Issue
Block a user