Open ctsstc opened 6 years ago
Or does this already exist? I noticed there's a ton of functions prototyped/exposed on the global.cssjs = fi;
There may need to be a README update, or additional documentation added.
Maybe utilize something such as ESDoc.
Digging into the source I've found these nifty functions to help me with what I was already trying to do:
const CSSJS = require("css.js");
const CSS = new CSSJS.cssjs();
let parsed = CSS.parseCSS(styling);
parsed = CSS.applyNamespacing(parsed, prefix);
let css = CSS.getCSSForEditor(parsed);
That's exactly what I need it for, thanks! I couldn't see any tests for applyNamespacing(), though.
Actually, just an addendum on this @ctsstc
You could call applyNamespacing(myCss)
without calling parseCss
because this method checks if you're passing a string and calls parseCss for you (see around line 557 of the unminified file)
I would love to be able to edit the parsed object and then stringify it back to CSS.