This module exports the following methods:
Returns: Root<Node>
Parses a given String
and returns an AST with a Root
node. If the input is an invalid CSS value, a CSSSyntaxError
is thrown.
Type: String
Required
Type: Object
Type: Boolean
Default: false
If true
, will allow all unknown parts of the value to be parsed and added to the AST. Similar functionality in the previous version went by the loose
option name. If false
, unknown values will throw CssSyntaxError
.
Type: Boolean|Object
Default: false
Set this option to enable parsing of interpolated values for languages such as SCSS. For example:
interpolation: { prefix: '@' }
will allow parsing of the interpolated value @{batman}
which uses @
as the "prefix". For SCSS one might use interpolation: { prefix: '#' }
.
Type: Object
Default: { prefixes: ['--'] }
Set this option to modify how variables are identified in a value. By default, this option is set to recognize CSS variables. For languages such as LESS and SCSS which have their own variable prefixes, additional prefixes can be added to the prefixes
array.
A Function
with a signature matching (bit) => {}
used to concatenate or manipulate each portion (or bit) of the Node's own AST. The nodeToString
method makes use of this, as a simple example.
Type: Node
Required
The Node
to stringify.
Type: Function
Required
Transforms a Node
into its String
representation.
Type: Node
Required