Changelog
2.0.2 (December 10, 2021)
width
, min-width
and max-width
syntax definitionsmdn-data
source-map
with source-map-js
which reduce install size by ~700KBcalc()
function consumption on definition syntax matchinggenerate()
auto emitting a whitespace edge cases when next token starts with a dash (minus)generate()
safe mode to cover more cases for IE11dist/data.cjs
and dist/version.cjs
css-tree/definition-syntax-data
css-tree/definition-syntax-data-patch
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 package