https://github.com/nodef/svgdom-css
Include custom CSS along svgdom.
https://github.com/nodef/svgdom-css
css dom svg svgdom
Last synced: about 1 month ago
JSON representation
Include custom CSS along svgdom.
- Host: GitHub
- URL: https://github.com/nodef/svgdom-css
- Owner: nodef
- License: mit
- Created: 2018-04-26T07:07:12.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-10-15T11:34:18.000Z (over 2 years ago)
- Last Synced: 2025-01-26T09:15:50.817Z (over 1 year ago)
- Topics: css, dom, svg, svgdom
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/svgdom-css
- Size: 104 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Include custom CSS along svgdom.
> I was using this to use [chartist] on node.js.
```javascript
const css = require('svgdom-css');
const fs = require('fs');
/* (a default window is defined) */
// css()
// -> window
var customcss = '.ct-label { font-family: Courier; font-weight: bold; }';
var window1 = css(customcss);
// -> window
var path = require.resolve('chartist/dist/chartist.min.css');
var window2 = css(fs.readFileSync(path, 'utf8'));
// -> window
var window3 = css(customcss + fs.readFileSync(path, 'utf8'));
/* (css overloading not supported, custom css must be included first!) */
// -> window
```
## References
- [svgdom :: Ulrich-Matthias Schäfer](https://www.npmjs.com/package/svgdom)
- [stylis :: Sultan](https://www.npmjs.com/package/stylis)
[chartist]: https://www.npmjs.com/package/chartist
