Skip to content

nodef/svgdom-css

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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