Skip to content

Commit 88d4bdf

Browse files
authored
Update readme
Add static script usage instructions.
1 parent 9c445c3 commit 88d4bdf

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ Give it a try on [Cascades](https://demo.cascades.app/) ✨
99

1010
## Usage
1111

12+
> [!NOTE]
13+
> CSS-to-HTML relies on some browser-only JS features, so it doesn't work in Node (yet).
14+
> If you want to use this in a Node project, please use a webdriver like [Puppeteer](https://pptr.dev/).
15+
16+
### With a Bundler
17+
1218
```sh
1319
npm i css-to-html
1420
```
@@ -25,9 +31,22 @@ const css = document.querySelector('style').sheet.cssRules;
2531
const html = await cssToHtml(css);
2632
```
2733

28-
> [!NOTE]
29-
> CSS-to-HTML relies on some browser-only JS features, so it doesn't work in Node (yet).
30-
> If you want to use this in a Node project, please use a webdriver like [Puppeteer](https://pptr.dev/).
34+
### Or as a Static Script
35+
36+
Download the latest script from the [releases page](https://github.com/Cascades-CSS/CSS-to-HTML/releases). Then include the script in your site:
37+
38+
```html
39+
<script src="path/to/css-to-html.js"></script>
40+
41+
<script>
42+
const css = 'p { color: purple; }';
43+
44+
cssToHtml(css).then(html => {
45+
console.log(html);
46+
});
47+
</script>
48+
```
49+
3150

3251
## Example
3352

0 commit comments

Comments
 (0)