change data attrib

This commit is contained in:
Cory LaViska
2024-06-11 14:38:22 -04:00
parent 5d5ac5576e
commit 530673dcd1

View File

@@ -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') || '');
}
}