File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed
Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff 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
1319npm i css-to-html
1420```
@@ -25,9 +31,22 @@ const css = document.querySelector('style').sheet.cssRules;
2531const 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
You can’t perform that action at this time.
0 commit comments