-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add info about global styles and font licensing to the readme
- Loading branch information
Showing
1 changed file
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,12 +20,37 @@ npm i @statistikzh/leu | |
|
||
## Usage | ||
|
||
In order for the components to work, you need to load the theme styles and the font definitions globally. | ||
The theme file is part of the package (`dist/theme.css`). | ||
The fonts on the other hand have to be licensed and are therefore not included in the package. | ||
|
||
If you have an environment that resolves bare module imports, you can use the library like this: | ||
|
||
```html | ||
<link rel="stylesheet" href="@statistikzh/leu/theme.css" /> | ||
<script type="module"> | ||
import "@statistikzh/leu/leu-input.js" | ||
</script> | ||
|
||
<leu-input></leu-input> | ||
``` | ||
|
||
### CDN | ||
|
||
Browsers can't resolve bare module imports without import maps. But we can use a CDN to resolve the imports for us. | ||
This is useful if you're just using plain HTML and JavaScript without any build or transformation steps. | ||
Also this is applicable in an environment like [Observable](https://observablehq.com). | ||
|
||
```html | ||
<link | ||
rel="stylesheet" | ||
href="https://esm.run/@statistikzh/[email protected]/dist/theme.css" | ||
/> | ||
<script type="module"> | ||
import "@statistikzh/leu/leu-radio.js" | ||
import "https://esm.run/@statistikzh/leu@0.1/dist/leu-input.js" | ||
</script> | ||
|
||
<leu-radio></leu-radio> | ||
<leu-input></leu-input> | ||
``` | ||
|
||
## Linting and formatting | ||
|