mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 12:09:26 +00:00
change data attrib
This commit is contained in:
@@ -55,20 +55,20 @@ export function setKitCode(code: string) {
|
||||
* Gets the library's Web Awesome kit code.
|
||||
*
|
||||
* The kit code is used to fetch premium assets, so it needs to be set for certain components to work correctly. This
|
||||
* isn't something we can infer, so the user will need to provide it using the `data-webawesome-kit` attribute. This can
|
||||
* isn't something we can infer, so the user will need to provide it using the `data-fa-kit-code` attribute. This can
|
||||
* be on any element, but ideally it should exist on the script that imports Web Awesome.
|
||||
*
|
||||
* <script src="bundle.js" data-webawesome-kit="abc123"></script>
|
||||
* <script src="bundle.js" data-fa-kit-code="abc123"></script>
|
||||
*
|
||||
* Alternatively, you can set the kit code manually using the exported `setKitCode()` function.
|
||||
*
|
||||
*/
|
||||
export function getKitCode() {
|
||||
if (!kitCode) {
|
||||
const el = document.querySelector('[data-webawesome-kit]');
|
||||
const el = document.querySelector('[data-fa-kit-code]');
|
||||
|
||||
if (el) {
|
||||
setKitCode(el.getAttribute('data-webawesome-kit') || '');
|
||||
setKitCode(el.getAttribute('data-fa-kit-code') || '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user