UNPKG

@dev-toolbox/css-json

Version:

@dev-toolbox/css-json package is created for the developers to parse the CSS and get the structured data in multiple helpful formats. In Simple Terms this package Parse JSON from CSS string and it can transform the generated JSON to string CSS.

27 lines (16 loc) 579 B
# Install `npm i @dev-toolbox/css-json` ## Import `import { CssJson } from '@dev-toolbox/css-json';` ## Usage const cssString = '.test{color:red;}'; const options = {}; const parser = new CssJson(CssString,options); const output = parser.parse(); console.log('output', output); ## Available Options const defaultOptions: ICssJsonOptions = { resultType: CssJsonResultType.ADVANCED, seperateMultiSelectorStyles: false, //will omit this if resultType===CssJsonResultType.ADVANCED, keyValueAttributes: false, //will omit this if resultType===CssJsonResultType.ADVANCED, };