npm.io
0.2.7 • Published 2 years ago

svgdom-css

Licence
MIT
Version
0.2.7
Deps
2
Size
4 kB
Vulns
0
Weekly
0

Include custom CSS along svgdom.

I was using this to use chartist on node.js.


const css = require('svgdom-css');
const fs = require('fs');
/* (a default window is defined) */
// css(<css string>)
// -> 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

Keywords