convert-css
Parse and convert css. The focus is on JSON as it's needed for other services, and other easier conversions like modules in js for css-in-js.
Install
$ npm install convert-css --save
Usage
const fs = ;const cssToCamelizedJson = ; const handleErr = { iferr console; }; fs;
Documentation
Table of Contents
sequence
[sequence takes in functions and calls them in sequence, same as pipe]
Parameters
args
[Functions] [n number of functions]
Returns Any [result of last function in sequence]
replaceCssSyntax
replaceCssSyntax is a function will pipe a string [key] through more functions to replace and normalize css rule keys
Type: String
convertKey
[convertKey replaces css selector syntax with underscores ]
Parameters
key
[String] [css selector]
Returns [String] [reformatted selector key]
mungeRules
[mungeRules reformats rules array from css ast]
Parameters
rules
[Array] [an array of css rules]
Returns [Array] [array of css rules with keys for JSON]
cssToJson
[cssToJson takes a string as a parameter and returns JSON]
Parameters
string
[String] [css string]
Returns [Object] [JSON derived from css ast]
cssToCamelizedJson
[cssToCamelizedJson takes a string as a parameter and returns JSON]
Parameters
string
[String] [css string]
Returns [Object] [camelized values in JSON object derviced from ast]