Changelog
2.0.1 (December 4, 2021)
^12.20.0
and ^14.13.0
versionsChangelog
2.0.0 (December 3, 2021)
^10 || ^12.20.0 || ^14.13.0 || >=15.0.0
)import * as parser from "css-tree/parser"
or require("css-tree/parser")
):
css-tree/tokenizer
css-tree/parser
css-tree/walker
css-tree/generator
css-tree/lexer
css-tree/definition-syntax
css-tree/utils
dist/csstree.js
(an IIFE version with csstree
as a global name) and dist/csstree.esm.js
(as ES module). Both are minifiedmdn-data
to 2.0.23
tokenize()
to take a function as second argument, which will be called for every token. No stream instance is creating when second argument is ommited.TokenStream#getRawLength()
to take second parameter as a function (rule) that check a char code to stop a scanningTokenStream#forEachToken(fn)
methodTokenStream#skipWS()
methodTokenStream#getTokenLength()
methodSyntaxError
(custom parser's error class) from root of public API to parser via parse.SyntaxError
parseError
field in parser's SyntaxError
{ type: 'Combinator', name: ' ' }
node instead of WhiteSpace
nodeWhiteSpace
nodes with the single exception for a custom property declaration with a single white space token as a value+
and -
operators, when a whitespace is before and/or after an operatorparse.config
consumeUntilBalanceEnd()
, consumeUntilLeftCurlyBracket()
, consumeUntilLeftCurlyBracketOrSemicolon()
, consumeUntilExclamationMarkOrSemicolon()
and consumeUntilSemicolonIncluded()
methods to parser's inner API to use with Raw
instead of Raw.mode
Nth
to always consume of
clause when presented, so it became more general and moves validation to lexerString
node type to store decoded string value, i.e. with no quotes and escape sequencesUrl
node type to store decoded url value as a string instead of String
or Raw
node, i.e. with no quotes, escape sequences and url()
wrapperchunk()
handler to token()
(output a single token) and tokenize()
(split a string into tokens and output each of them)mode
option for generate()
to specify a mode of token separation: spec
or safe
(by default)emit(token, type, auto)
handler as implementation specific token processorNth
to serialize +n
as n
string
and url
tokens on serializationLexer#matchDeclaration()
methodident
, string
and url
helpers to decode/encode corresponding values, e.g. url.decode('url("image.jpg")')
=== 'image.jpg'
List
to be iterable (iterates data)List#first
, List#last
and List#isEmpty
to gettersList#getSize()
method to List#size
getterList#each()
and List#eachRight()
methods, List#forEach()
and List#forEachRight()
should be used insteadChangelog
1.1.3 (March 31, 2021)
fit-content
to width
property patch as browsers are supported it as a keyword (nonstandard), but spec defines it as a functionparseValue
option is set to false
, in that case !important
was included into a value but must not (#155)Changelog
1.1.2 (November 26, 2020)
Changelog
1.1.1 (November 18, 2020)
SyntaxMatchError
Changelog
1.1.0 (November 17, 2020)
mdn-data
to 2.0.14fork()
method to allow append syntax instead of overriding for types
, properties
and atrules
, e.g. csstree.fork({ types: { color: '| foo | bar' } })
Lexer#checkAtruleName(atruleName)
, Lexer#checkAtrulePrelude(atruleName, prelude)
, Lexer#checkAtruleDescriptorName(atruleName, descriptorName)
and Lexer#checkPropertyName(propertyName)
Lexer#getAtrule(atruleName, fallbackBasename)
methodLexer#getAtrulePrelude()
and Lexer#getProperty()
methods to take fallbackBasename
parameterSyntaxMatchError
location detailsChangelog
1.0.1 (November 11, 2020)
parseCustomProperty:true
Changelog
1.0.0 (October 27, 2020)
onComment
option to parser configbreak
and skip
values in walk()
to control traversalList#reduce()
and List#reduceRight()
methodsmdn-data
to 2.0.12import { version } from 'css-tree'
)Lexer#dump()
to dump atrules syntaxes as well<urange>
list (#135)HexColor
node type into Hash
element()
specific parsing rulesdist/default-syntax.json
from packageChangelog
1.0.0-alpha.39 (December 5, 2019)
visit: "Declaration"
to iterate DeclarationList
(#114)Changelog
1.0.0-alpha.38 (November 25, 2019)
mdn-data
to 2.0.6
Lexer#matchAtrulePrelude()
and Lexer#matchAtruleDescriptor()
methods-moz-control-character-visibility
, -ms-grid-columns
, -ms-grid-rows
and -ms-hyphenate-limit-last
properties to patch (#111)flow
, flow-root
and table-caption
values to patched display
(#112)