package cascade
Build not yet checkedInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=6240100b1bc62f7e33f820fa3d7f23155f36f9c77d17a49de9e3559141414a08
sha512=3f9a8f7cabf16a09f063e5f807d74f0f9fac8ca1eda01b1873e67ac8289a37837341ae2db1a163ac7965a8360f1601dacdc3fba2d718857caef064827913b1e4
doc/CHANGES.html
1.3.0 (30/11/2026)
1.2.1 could minify a sheet into one that renders differently, and cascade diff --diff=canonical could not tell a change in rendering from a change in spelling. This release fixes both and runs two to three times cheaper.
- Minified output that renders as its source does.
--minifyread-webkit-linear-gradient(top,...)as the unprefixed syntax, so the gradient changed direction. It listed a rule over a vendor selector with other rules, and a browser that does not read that selector dropped them all. It could drop a border side, move a rule past one that styles the same element, and printp:not(:not(.a .b))as another selector. On 1.2.1's--minifyoutput, 1.3's canonical diff finds a difference from the source in 190 of the 504 SatCSS sheets, most over a prefixed gradient. If you ship CSS minified by 1.2.1, upgrade and minify again. - A canonical diff you can gate a build on.
cascade diff --diff=canonical style.css style.min.cssexits 0 for each of the 504 SatCSS sheets and for Tailwind's output against its own--minifyoutput. With 1.2.1, 139 of the 504 failed: 94 reported a difference and 45 exited 2. 1.2.1 also called two sheets identical when one had lost a rule inside@mediato a parse error. - Speed.
--minifytakes less than half the CPU of 1.2.1 over the SatCSS corpus, and about a third on Tailwind's output.cascade diff --diff=canonicalof Tailwind's stylesheet against tw's takes less than a third. - Stable output. Minifying
--minifyoutput again returns it byte for byte, on all 504 SatCSS sheets and on Tailwind's output. With 1.2.1, 69 of those sheets and both Tailwind stylesheets shrank again. Output does not depend on hash order, and numbers print the same on Windows as elsewhere. - Warnings you can read. A warning reads
file:line:column: warning: messageover the source line and a caret. Repeats are counted under the first, so netflix.com's sheet prints about 40 lines where it printed nearly 500, and-qsilences them. - Smaller output. Over the SatCSS corpus and Tailwind's output,
--minifyoutput is about 1.7% smaller raw than with 1.2.1 and about the same size compressed: half a percent smaller under gzip, a little less under brotli. One sheet can still come out a little larger compressed; Which rules merge says why.
Most entries below come from checking --minify against the browsers it targets. The targets are floors: Chrome 111, Firefox 128 and Safari 16.4, each with every later release. --minify deletes nothing a target applies, and rewrites no form a target drops into one that target applies. So many fixes read "kept as written", for a form only some browsers read, or "dropped, as browsers drop it", for one no target reads.
The test suite asks headless Chromium. One harness generates values for every property and reports each value the browser keeps and cascade drops, or the reverse. A second does the same over malformed CSS, and a third renders a sheet beside its minified output and compares the pages. Fuzzers and a corpus of spellings check that printed output reads back as itself and that a second pass changes nothing. What Firefox and Safari do comes from MDN's compatibility data and from the releases the entries name.
Four more themes run through the list:
- Two modes. By default cascade follows the target browsers, also where they depart from a specification.
--enforce-specfollows the Editor's Drafts and relies on no browser. Where the two differ, the entry says what each does, as for abackground-blend-modebefore abackground, the basisflex:1omits andcalc-size()inflex. var()and custom properties. Avar()substitutes any number of tokens, so no value is folded or reordered around one, and a custom property's own tokens are written as read.- Math functions, numbers and colours. A math function is read wherever CSS Values 4 puts one, and kept when its result is past a property's range. A colour keeps the space it interpolates in and its
nonecomponents, as CSS Color 4 defines them. - Output that settles in one pass. Two spellings of one value merge on the first run, and more rules merge: see Stable output and Which rules merge.
The price is under Breaking. On the command line, a script that reads cascade's diagnostics needs a new pattern. In the library, parsers return a result instead of raising, and two spellings of one selector are one value. Css.to_string ~minify:true prints the sheet it is given, and Css.minify does what it used to. Each removed function is listed with what to call instead, and most migrations are a rename or a deleted call.
Breaking
Command line
- Warnings and errors have a new form. A warning gave a byte range, a trace of the reader's own functions (
read_declaration/float:) and an(in component)tag, and cascade's own messages took another form (Error: ...). Every diagnostic readsfile:line:column: warning: messageorfile: error: message, as a compiler's does, and a parse diagnostic is followed by the source line with a caret under the span. A warning fromcascade diffnames the input it is about, and a sheet parsed from a string without a name prints as<CSS input>. A script that matches cascade's standard error matches the new form, or readscascade diff --json(#1299, #1330, #1331, #1337). cascade diffgives positions as members, counted from 1.--jsonmade a consumer parse the location out of each message, and the text report counted lines and columns from 0 while warnings counted from 1, so a difference at the start of the second line readline 1, col 0. Each warning and error of the--jsondocument hasfile,lineandcolumnmembers, and itsmessageis the reason alone. The report and the document count from 1, and the report's@@header names the line instead of a byte offset. Read the location from the members, and stop adding 1 (#1331, #1334).- A missing input file exits 124.
cascade fmt missing.cssexited 1, the status of a file that failed to parse. It exits 124, as the other commands do (#1338).
OCaml library
cascade keeps no deprecated aliases, so a removed function fails to compile where it is called. Each entry says what to write there. A type with new cases needs them in an exhaustive match.
- Parsers return a
result. They failed in three ways,Error.Parse_error,FailureandInvalid_argument, so no single handler caught a malformed input.Selector.of_string,Container.of_string,Supports.of_string,Declaration.of_string,Declaration.with_value,Media.of_string_strict,Media.value_of_string,Keyframe.selector_of_stringandFont_face.*_of_stringreturn(_, Error.t) result, andAria.of_stringan option. Match on the result and print an error withError.to_string. For CSS written in the program, useSelector.v,Container.vorCss.stylesheet, which raiseInvalid_argument(#1299, #1367). Css.of_string_exnis gone. It raisedError.Parse_errorwhere every other function for CSS written in the program raisesInvalid_argument. UseCss.stylesheet, which takes the same arguments. A handler forError.Parse_erroraround the call moves toCss.of_stringand itsErrorcase (#1299, #1367, #1391).- Misuse raises
Invalid_argument.Declaration.custom_property,Supports.property,Supports.funcandSupports.property_nameraisedFailureon a bad argument. Atry ... with Failure _around them still compiles and stops catching: catchInvalid_argument(#1299). Css.to_string ~minify:trueprints the sheet it is given. The minified printer also rewrote the sheet, so its text did not read back as the value printed. It folded:nth-child(1)and:is(:link,:visited), dropped an@charsetand an@font-facewithoutfont-familyorsrc, moved a registered<color>variable in abox-shadow, rounded a colour's alpha, dropped0%and100%from a gradient's end stops and folded the rows ofgrid-template-areas. Code that prints with~minify:truewithout optimising first compiles and prints longer output. CallCss.minify, which optimises and prints ascascade --minifydoes. For one step alone, callSelector.canonicalize,Stylesheet.drop_inert_at_rulesorStylesheet.normalize_shadow_color_vars(#1350, #1351, #1354, #1367, #1370).Selector: one value whatever the spelling.:beforeand::before,[x=a]and[x="a"],oddand2n+1were different values, so equality, hashing and deduplication missed them, and parsing a printed selector could give back another value.Before,After,First_letterandFirst_linetake no argument andcolon_formis gone.Exact_quoted (v, _)and the other*_quotedattribute matches areExact vand so on, withvdecoded.OddisAn_plus_b (2, 1)andEvenisAn_plus_b (2, 0). The printer picks the spelling.Selector.talso hasWebkit_full_screen,Webkit_full_screen_ancestorandMoz_full_screencases (#1357, #1408).Errorhas a shared source and three new kinds. Each error located itself by counting lines from the start of its source, so printing a sheet's warnings cost its size per warning. The errors of one parse share one index, and thesourcefield ofError.tis anError.Source.t. Code that reads or builds that field, or passes?sourcetoCursor.of_componentsorStylesheet.read_stylesheet_of_rules, wraps the text withError.Source.vand reads it back withError.Source.text;Error.positiongives the line and column.Error.kindhas three new cases.Invalid_statementis a statement the rules around it refuse, such as an@importafter a style rule, which was aBad_valuefor a property calledstylesheet.Untargeted_selectoris a selector no target browser reads, andToo_deepis input nested past the reader's bound. The eightError.fail_*functions each spelledError.failon one constructor: callError.fail (Error.bad_value loc ~property ~reason)(#1296, #1299, #1310, #1331, #1371, #1391, #1429).Readerhas no error type of its own.Reader.Parse_error, itsReader.parse_errorrecord,Reader.pp_parse_error,Reader.with_filename, theerrfunctions (err,err_eof,err_expected,err_expected_but_eof,err_invalid) and the context stack (push_context,pop_context,with_context,callstack) are gone: no parser raised that type and noof_stringreturned it. Code that writes its own readers onReaderbuilds anError.tand raises it withError.fail:Error.unterminatedforerr_eof,Error.missing_tokenforerr_expectedanderr_expected_but_eof,Error.bad_valueforerranderr_invalid. CatchError.Parse_error, print withError.to_string, name the source withError.with_filenameand label a sub-reader withError.with_context.Reader.skipat the end of input raisesInvalid_argument; testReader.is_donefirst (#1299).Cursor.try_enumandCursor.err_eofare gone. UseCursor.option (Cursor.enum label table), which also skips leading whitespace, andError.fail (Error.unterminated loc sort)(#1371, #1391).Component.thas aFlatcase. The contents of a block or function nested pastParser.max_nesting_depth(128) are kept as the tokens read, not as a tree, since deeper input overflowed the stack (see Parsing). Code that only looks for aBlockor aFunccan ignore the case (#1296).- A custom property's tokens carry no source position. Two declarations of one custom property with one value compared and hashed differently depending on where they were read, so a table keyed on declarations kept both. The positions were offsets into the value's own text and located nothing in the sheet.
Component.source_locgivesLoc.dummyfor these tokens, andComponent.as_valuesdrops the positions from a token list you build (#1353, #1386). Properties.propertyhas new cases.Text_rendering,Webkit_touch_calloutand a constructor for each of thirteen-webkit-legacy aliases,Webkit_flexandWebkit_transform_originamong them, are new, and an alias carries its unprefixed property's value type. Code that found one of these among the unknown properties finds it typed (see Comparing stylesheets and Smaller output) (#1440, #1442, #1518).Properties.opacityandProperties.shape_image_thresholdkeep a percentage. Both read50%as the number.5, so a percentage beside avar()lost its type (see Rendering fixes). They have anOpacity_percentageand aPercentagecase, holding the percentage as written (50.for50%);Css.optimizeturns it into the number wherever novar()shares the calculation (#1456).Css.white_spaceholds the longhand pair.CollapseandPreserve_nowrapare gone, andLonghands (collapse, mode)spells the pair. A match onCollapsemoves toLonghands (Some Collapse, None), and one onPreserve_nowraptoLonghands (Some Preserve, Some No_wrap)(#1539).- Value types have new cases for values
--minifydeleted (see Rendering fixes).Css.lengthhasRex,Rcap,Rch,Svi,Svb,Lvi,Lvb,DviandDvb.system_color,cursor,display,overflow,text_align,unicode_bidi,writing_mode,image_rendering,appearance,dominant_baseline,contentandlengthhave the prefixed, legacy and newer keywords.Properties.insethasTrailing, for aninsetwritten after a body holding avar(): treatTrailing bodyasBody bodywith the keyword printed last (#1511, #1536, #1539). Statsreports only what the optimizer did. A factoring run records one row, soStats.iteration_stat'slocal_iterationandactive_passeswere always 1, and itsiterationandStats.counters'siterationsrepeated the run number.Stats.revert_fixpointandfactor_transfer_revertscounted runs thrown away by a gate that is gone. All are gone,changed_passesischanged : bool, andStats.record_iterationtakes the remaining fields.elapsedis 0 unless the recorder was made with~profile:true, as the byte columns already were. Read the run number fromfixpoint, and testchangedwhere you testedchanged_passes > 0(#1372, #1399).- Three
Optimizefunctions are gone.Optimize.duplicate_buggy_propertiesandOptimize.apply_property_duplicationreturned their input unchanged, though documented as duplicating properties for buggy browsers. Delete the call;Optimize.add_compatibility_prefixeswrites the WebKit fallbacks. Nothing in cascade readOptimize.edges_of_ruleor itsedgeandpacked_propertytypes. Build the pairs fromSelector_summary.of_selectorandStylesheet.declarations, keyed byDeclaration.property_key(#1345, #1367, #1371, #1391). - An
@importrule'surlholds the url, not its source text. The field held the source spelling (url("theme.css"),'theme.css') when the rule was read from a sheet and the decoded url on other paths, so a printer could not tell@import '"x".css'from a spelling and printed it unescaped. It holds the decoded url on every path:theme.cssfor each ofurl(theme.css),url("theme.css")and"theme.css". Code that builds animport_rulewritesurl = "theme.css";url = "url(theme.css)"prints as@import "url(theme.css)", an import of the file namedurl(theme.css)(#1460). Css.decode_import_urlis gone. It recovered the url from the source spelling, and read a decoded"url(a.css)"asa.css. ReplaceCss.decode_import_url ir.urlwithir.url(#1460).- A
@counter-stylesymbol says which kind it is.Symbolsheld astring listandPrefixandSuffixastring, so an image symbol printed back as a string. They holdStylesheet.counter_symbolvalues:String,Image(aProperties.background_image) orIdent. Wrap each string inString, or inIdentfor a name written without quotes (#1461). counter()andcounters()content items carry a counter style.Counter of stringandCounters of string * stringareCounter { name; style }andCounters { name; separator; style }, the style alist_style_type option(CSS Lists 3 sec. 4.6),Nonefor the default.Css.content_counterandCss.content_counterstake an optional?style(#1462).Properties.contenthas aWith_altcase.With_alt { content; alt }holds the alternative text CSS Generated Content 3 sec. 1.1 letscontentend with:altis the list of strings,counter(),counters()andattr()items after the/(#1474).Values.math_fnhasMin_n,Max_nandClamp_n, for amin(),max()orclamp()over a time, an angle or a percentage. Each holds themath_args as written, and aClamp_nbound is an option,Nonefor thenonekeyword (#1475, #1569).Pp.quotedis gone. It wrote a string between double quotes without escaping it. UsePp.quoted_string, which escapes what CSSOM 1 sec. 2.1 escapes and takes an optional~quote(#1460).- Integer and number slots may hold a calculation.
counter_item.valueis anumber option(wasint option),font_feature_value'sIndexcarries anumber(wasint),font_variation_setting.valueis anumber(wasfloat), androtate_value'sAxiscarries threenumbers (werefloats); matchNum nfor a literal.Css.counter_item ?valuestill takes anint.Values.read_number_slotandValues.read_integer_slotread such a slot, andValues.pp_integer_slotprints an integer one as an integer token (#1584, #1619). Unknown_propertycarries anuntyped_namerecord (written,vendor,unprefixed,spells,own) instead of a string: build one withProperties.untyped nameand read the name fromwritten.Properties.vendorgives a property's vendor prefix (#1588).Shape_outsideholds aProperties.shape_outside(Shape,ImageorVar) instead of a string, andCss.shape_outsidetakes one (#1591).Context.cascade_ruleloses itsproperty_namefield. Read the name withDeclaration.property_name rule.declaration(#1594).- Colour types hold what a browser interpolates.
Values.colorhasAuthored_color { color; minified }, a colour kept as written because its digits past eight decimals decide the byte it paints (see Stable output).HslandHwbhold their two percentages as options and the alpha type hasAlpha_none, each for a component writtennone.Values.normalize_colortakes?enforce_specand neither?exact_srgbnor?resolve_missing(#1548, #1549, #1600, #1612). Calc_sizeholds an optional basis. InValues.lengthit isCalc_size of length option * length calc(waslength * length calc),Nonebeingany, andflex_basishas the same case (#1622).@font-facetypes have cases for what is kept as written.Font_face.metric_overridehasPercent_callandFont_face.size_adjusthasPct_call, each a math function that folds below zero and prints back ascalc().font_face_descriptorhasFont_family_as_writtenandFont_variation_settings_as_written, each the text of a form only some browsers read (#1625, #1629, #1630).- Prefixed gradients carry what their engine reads.
Webkit_radial_gradientandWebkit_repeating_radial_gradientcarry awebkit_radial_comma,Shape_commaorNo_shape_comma, between the configuration and the stops.Moz_linear_gradientandMoz_repeating_linear_gradientcarry amoz_gradient_direction,Legacy_directionorTo_direction, where they carried agradient_direction(#1605, #1606). - A custom property's printer takes no ident fold.
Parser.fold_value_ident,Values.fold_custom_value_identand the?fold_identargument ofParser.to_string_custom_minifiedare gone. Delete the argument (#1618). Optimize.merge_box_shorthand_longhandsandOptimize.merge_overflow_longhandstake~floors, the targets (#1633).Pp.ctxlosesin_function. It only chose how to casecurrentcolor; delete the field (#1648).Properties.vector_effectholds one keyword. SVG 2 (ED) sec. 8.13 spellsvector-effectas one keyword, and the reader takes one since #1637, but the type carried a list of effects and a host space no value could hold.Effectsgives way toNon_scaling_stroke,Non_scaling_size,Non_rotationandFixed_position, andvector_effect_keyword,vector_effect_spaceand theirpp_andread_functions are gone. WriteCss.vector_effect Non_scaling_strokewhereEffects ([ Non_scaling_stroke ], None)stood (#1646).- A colour channel may hold a calculation.
Values.channelgainsCalc, and theaandbofLabandOklaband thecofLchandOklchare aValues.axis option(werefloat option): matchAxis ffor a number andAxis_calcfor a math function an element resolves. A hue holding one is anAngle (Calc _).Values.oklab,Values.lchand the other constructors still take floats (#1644).
Minified output
Rendering fixes
Each entry is a sheet 1.2.1 minified into one a browser renders differently. They are the reason to minify again, and are grouped by what they touch.
Rule order and shorthands
- A rule could move past another that styles the same element. A later
@mediaor@containerblock merged into an earlier one across a list like.a:after,.a:beforethat styles the same pseudo-element. Two rules could also swap when they differ only in the case of a type selector (DIV,div), of an ID (quirks mode) or of an attribute value read through aniorsflag. Both orders are kept (#1295). - A rule with nested content moved past one that styles the same element.
--minifyread a rule as the declarations before its first nested statement, so.a{top:1px}.d{color:red} .a{@media (min-width:1px){color:blue}}became.a{top:1px;@media (width>=1px){color:#00f}}.d{color:red}, and an element with both classes turned red. A rule counts everything its body writes, under each nested rule's composed selector, and a merge or move that would cross a competing rule stays in source order. Of 9,000 random sheets with nesting, the number Chromium renders differently after--minifyfalls from 28 to 17; the rest come from writing or removing nesting (#1479). - A border side was lost. Moving declarations two rules share into one rule could drop a longhand a rule wrote after its own shorthand:
.b{background:#fff;border:1px solid #ddd}beside.a{background:#fff;border:1px solid #ccc;border-top:3px solid red}became.a,.b{background:#fff;border:1px solid#ddd}.a{border:1px solid#ccc}, and.alost its red top border, as 1.2.1's output of ebay, google-1 and sina in the SatCSS corpus does. What a rule keeps stays in the order it wrote it (#1404). - A distant
@mediamerge changed which@keyframesran. Joining two@media printblocks across a@keyframes kmoved the later@keyframes kabove it, so the earlier one won;@font-facetoo. A merged block carries style rules only (#1576). - A margin longhand jumped a logical one.
margin:0;margin-block-start:5px;margin-top:1pxbecamemargin:1px 0 0;margin-block-start:5px, so Chromium sets the top margin to 5px instead of 1px.padding,-webkit-margin-beforeand-webkit-padding-beforedid the same. A longhand folds into the shorthand before it only past declarations that write none of its sides, andcascade diff --diff=canonicalprints such a rule in an order it reads the same the next time (#1478). - Two longhands composed past a shorthand that resets one.
position-try-order:most-height;position-try:flip-inline;position-try-fallbacks:topbecameposition-try:most-height top;position-try:flip-inline, so the box falls back toflip-inlineinstead oftop.columnsdid the same past-webkit-columns. Two longhands compose only past declarations that do not write the later one (#1495). --scope=stylesheetdropped declarations a page needs. A shorthand built from longhands reset a declaration written before them:background:#fff url(a.png) no-repeat centerlost its image and colour to a laterbackground-positionandbackground-size. Default output is unchanged (#1348).--scope=stylesheetbuilt shorthands that reset what another rule set.h1{font-size:20px;font-family:serif}becameh1{font:20px serif}, which resets the browser's bold heading weight (700 to 400 in Chromium), and anemlost its italic the same way. Next to.y{font-weight:bold}or.y{background-repeat:no-repeat},.xlost the weight or the repeat on an element of both classes, and atransitionbuilt outside@mediareset atransition-delayinside it. The scope rules out CSS outside the sheet, not the sheet's other rules or the browser's own, so a shorthand is built from part of its longhands only when none of them sets the others (#1482).borderreset aborder-imageset elsewhere.--minifycontractedborder-width,border-styleandborder-colorintoborder, which also resetsborder-image(CSS Backgrounds 3 sec. 4.4), so Chromium drew none where another sheet of the page, or a rule of the same sheet inside@media, set one. The three stay longhands. Under--scope=stylesheetthey contract when no rule of the sheet, in any block, holds aborder-imagevalue, and so do the four sidesborder-top,-right,-bottomand-leftholding one value.cascade diff --diff=canonicalcalls the two spellings different (#1537).- A shorthand replaces longhands only when every target browser that reads them reads it:
border-top-color:light-dark(red,blue)and three plain sides became oneborder-colorChrome 111 to 122 drop whole,margin:5pxthenmargin-top:clamp(none,1px,2px)onemarginChrome 145 drops, andtext-wrap-modewithtext-wrap-style:balanceatext-wrapSafari 17.4 drops (#1633). - A
background-blend-modebefore abackgroundwas dropped. Compositing 1 sec. 3.4.3 has the shorthand reset it, but Chrome and WebKit keep it, so the layers stopped blending. The default mode keeps it and--diff=canonicalcalls the two different.--enforce-specdrops it and calls them equal (#1599, #1602). maskboxes moved, and layer longhands merged into the wrong layers. One box in amasklayer sets bothmask-originandmask-clip, and two set them in order (CSS Masking 1 sec. 7.9), but--minifydropped eachborder-boxon its own:mask:url(a.png) border-box content-boxbecamemask:url(a.png)content-box, which moves the origin, andpadding-box border-boxbecamepadding-box, which moves the clip. It deletedmask:url(a.png) no-clip. Mask longhands with two images and onemask-repeat:no-repeatbecamemask:url(a.png),url(b.png)no-repeat, which repeats the first image;backgrounddid the same with one image and two repeats, or with avar()in a longhand, which can stand for another slot. Two boxes print as one only when they are one box,no-clipis read, and longhands merge into a shorthand only when they spell one layer with novar()(#1492).- A lone zero flex basis became a grow factor.
flex:0px,flex:0emandflex:calc(0px)becameflex:0, with or without--enforce-spec. Chromium readsflex:0as grow 0 over a0%basis, where the source is grow 1 over a0pxbasis: a lone unitless number inflexis the grow factor (CSS Flexbox 1 sec. 7.2). A lone zero basis keeps its unit (#1459).
Selectors, nesting and at-rules
- Vendor selectors took other rules down with them. A browser that cannot read one selector of a list drops the rule for the whole list (Selectors 4 sec. 3.9).
--minifymerged.a:-moz-focusring{color:red}and.b{color:red}into one list, so Chromium lost.b's colour, and mergeda::-moz-placeholderwitha::-webkit-input-placeholder, so Chromium dropped both. It split an author's list such asinput::file-selector-button,b::-moz-selection{background:red}, so Chromium painted a button the source left alone. It listed.a:popover-openwith.b:user-valid, which Chrome 111 and Safari 16.4 both drop, though Chrome 114 to 118 reads the first alone and Safari 16.5 and 16.6 the second alone. Which targets drop a selector comes from MDN's compatibility data, Firefox's selector parser and browser probes. Two selectors share a list only when every release at or past the targets reads both or neither, and an author's list stays as written (#1407, #1428, #1437, #1468). - Rules over vendor pseudo-classes were dropped or revived.
--minifydropped rules over:-webkit-full-screen,:-moz-full-screen,:-webkit-any-linkor:-moz-only-whitespaceas unknown, though a target browser reads each. It printedinput:-webkit-input-placeholder, a rule every browser drops, asinput::-webkit-input-placeholder, which they read, so the placeholder took a colour the source never gave it: only:before,:after,:first-lineand:first-letterare pseudo-elements after one colon (Selectors 4 sec. 3.6.1). A rule is dropped only when no target reads its selector, with a warning (#1408, #1427, #1449). - Selectors came out as other selectors.
p:not(:not(.a .b))was printed asp.a .b; a double negation holding a type or a combinator prints as:is(X). Attribute values were unquoted into selectors browsers drop ([x="-2"],[x="-"]) or into another value ([x="a\\b"]). The printer takes the shorter of an escaped ident and a string that reads back as written, so[x="a b"]prints as[x=a\ b](#1292, #1350, #1357). - Names with a control character broke their rule. A control character written as an escape (
\1) in an attribute name, in::part(),:state(),:dir(),::highlight()or the view transition selectors, in an@namespaceprefix or@supportsfunction, or in the nameattr(),env()oranchor()reads, was printed raw. A browser reads the raw character as punctuation and drops the rule or declaration (Chromium drops[\x01]{}and keeps[\1 ]{}). Every name is written as CSSOM sec. 2.1 serialises an identifier, selectors included: a class holding a letter from U+0080 up prints the letter instead of a hex escape, and U+000E prints as\ewhere it printed as\E(#1551, #1634). - Unwrapping
:is()took other selectors down.--minifyprinted.c,:is([x=a s])as.c,[x=a s].:is()drops an argument a browser cannot read on its own, but a plain list is dropped whole, and Chromium reads nosflag, so.clost its colour. The same happened to:is(:-moz-focusring)and:not(:not(...)), andcascade diff --diff=canonicalcalled the two spellings equal. An argument some target does not read keeps its:is()(#1552). &under a pseudo-element styled the pseudo-element.&cannot represent a pseudo-element (CSS Nesting 1 sec. 4), sop::before{&{color:blue}}styles nothing, and Chromium leaves the::beforealone.--minifyprinted it asp:before{color:#00f},--flatten-nestingturned.x &underp::beforeinto.x p:beforeand&:hoverunder::part(p)into::part(p):hover, andcascade diff --diff=canonicalcalledp::before{color:red;&{color:blue}}equal top::before{color:blue}. Such a rule matches nothing and goes, a list parent's pseudo-element branch gives¬hing, and no rule is nested under a pseudo-element (#1503).- Nesting inside
@scopelost the scoping root. A rule in an@scopeblock is relative to the scoping root (CSS Cascade 6 sec. 3.5.3).--minifymerged@scope (.c){.a{.x &{...}}}into.x .aand--flatten-nestingturned@scope (.c){:is(.a,.b){.a &{...}}}into.a :is(.a,.b), so an.xor.aoutside the scope stopped counting. Flattening also turned.a{@scope (.b){color:red}}into@scope(.b){.a{color:red}}, which styles an.ainside a.brather than a.binside an.a. Flattening spells the root as&where a selector no longer starts with its parent,--minifykeeps such a rule nested, and a nested@scoperoots under its parent (#1504). - Nesting the default targets do not read.
--minifyturned.a{color:red}.a .b{color:blue}into.a{color:red;.b{color:#00f}}, kept an author's nesting, and turned& divintodiv. Chrome 111 and Safari 16.4 read no nested rule, and Chrome 112 to 119 and Safari 16.5 to 17.1 refuse one that starts with an identifier. For the default targets and under--enforce-specnesting is flattened and none is synthesised, so sheets that nested come out larger. Library callers whose targets parse nesting keep it. A declaration after a nested rule, or directly in a nested group rule (CSS Nesting 1 sec. 5), stays in place only under targets from Chrome 130, Firefox 132 and Safari 18.2 (api.CSSNestedDeclarations), and is flattened into a copy of its parent below them. Under those targets a bare&{...}rule under a single selector becomes declarations:.a{b{color:red}color:#00f}rather than.a b{color:red}.a{color:#00f}(#1505, #1589). - Nesting gave
&another parent. Where nesting was synthesised,.c{.a{color:red}.a &{color:blue}}became.c .a{color:red;&{color:#00f}}anddiv{X}div>&{Y}becamediv{X;>&{Y}}, so&named the new parent. A rule whose selector holds&past its parent's prefix stays where it is (#1506). - Flattening revived rules a browser dropped: a browser that cannot read one branch of a parent such as
.c,[x=a s]drops it whole, nested rules included, but the flattened:is(.c,[x=a s]):hoverkept.c:hoverin Chromium. Such a branch is listed again beside the flattened selector, matching nothing (#1635). - An
@importafter a/*! */comment was dropped, and so was one after an unrecognised at-rule, though browsers apply both. An@importafter an@namespace, and an@namespaceafter a rule, go, as browsers ignore them (#1294). - Escaped
@pagenames were deleted:@page \1,@page a\:band a non-ASCII page name, which browsers keep, went, and@page 1, which they drop, stayed. The page name is read as an ident token and printed escaped (#1636). - A percentage media feature was read as a width bound.
@media (min-width:50%)became(width>=50%), though Media Queries 4 grants no percentage there and Chromium never matches it. It is kept as written (#1566).
Fallbacks, and forms only some browsers read
- A fallback a browser needs was dropped.
a{color:red;color:light-dark(red,blue)}becamea{color:light-dark(red,#00f)}, so Chrome 111 to 122 and Safari 16.4 to 17.4, which droplight-dark(), lost the colour. The same happened beforecontrast-color(),anchor(),anchor-size(),stretchandimage-set(), also when the two declarations sat in two rules of one selector, and beforewidth:fit-content(10px), which no browser reads, so Chromium 153 painted a different width.a{width:anchor-size(width);width:stretch}becamea{width:stretch}, since Chrome 111 reads neither, though Chrome 125 to 137, and Firefox from 147, read the first alone. The targets are floors: an earlier declaration is dropped only when every release from the targets to the newest in the compatibility data that reads it reads the later one too, and canonical diff counts it dead on the same terms (#1464, #1486). - A fallback before a prefixed value was deleted across rules.
.a{position:sticky}before.a{position:-webkit-sticky}lostposition:sticky, anddisplay:flexbeforedisplay:-webkit-boxlostflex, though a browser that reads only the unprefixed value then paints neither. The compatibility data does not say which browser reads a prefixed keyword, so an earlier value stays before one that uses such a keyword, across rules as inside one. Two values with the same prefixed words, such as two-webkit-linear-gradient()s, are read by the same browsers, and the earlier one goes inside one rule too (#1538). - A reversed counter was deleted.
--minifyrefusedcounter-reset:reversed(x), which CSS Lists 3 grants and Firefox reads, and aftercounter-reset:xit kept only the earlier write. It readsreversed(), and keeps the earlier write as the fallback for Chrome and Safari, which drop it (#1466). break-before:alwaysbecamepage, though in a multicol containeralwaysbreaks the column andpagethe page (CSS Fragmentation 3). Chrome dropsalways, so it broke a page the source never broke. Both values print as written, the legacypage-break-before:alwaysstill maps topage, and an earlierbreak-before:autostays as the fallback for browsers that dropalways(#1467).- Prefixed, legacy and newer keywords were deleted.
--minifydropped, with a warning, values Chromium 153 reads:cursor:-webkit-grab,display:-webkit-inline-box,width:-webkit-fill-available,overflow:overlay,writing-mode:tb-rl, the deprecated system colours such asWindowandThreeDFace,place-content:flex-start,content:no-open-quote,font:oblique 10deg 12px a,image-set("a.png"), a grid area named1a,perspective(none),white-space:preserveandborder-image:url(a.png) 30 // 5px, among others. Each is read, and a prefixed or legacy keyword keeps an earlier value of its property as its fallback, as-webkit-boxdoes (#1539). - Declarations in newer CSS were deleted.
--minifydropped, with a warning, a length in a root font unit (rex,rcap,rch) or a logical viewport unit (svi,lvb,dviand the rest), a container unit inflex-basisorflex, and any value holdingif()(CSS Values 5 sec. 8.3) or a custom function call such as--f()(CSS Mixins 1). Chromium 153 reads each, sofont-size:1rcaporwidth:if(media(print):1px;else:2px)lost its effect. Each length is read with its unit, and a value holdingif()or--f()is kept as written, as one holdingvar()is, when the call matches its own grammar (#1536). revert-ruleand anonebound ofclamp()were dropped.--minifydeletedwidth:revert-ruleandwidth:clamp(none,50%,80px)with a warning, though Chromium and WebKit read both, and merged.c{--x:1}.c{--x:revert-rule}into one rule, which changes what the keyword rolls back to (CSS Cascade 5 sec. 7.3.6). Both are kept,clamp()with anonebound is never folded, and a rule holdingrevert-ruleis never merged, split, or let shadow an earlier rule (#1569).- Forms that browsers read differently were deleted. No specification grants
font-family:inherit foo,default fooorui-serif Foo, which Chromium and Safari read, norborder:red,none, which Chromium reads asred. The same holds for an@font-facefamily name ofnone defaultorinherit foo, which Chromium and Safari read, and ofserif Foo, which Safari reads. Chromium alone readsresize:auto,text-orientation:sideways-right,alignment-baseline:auto, acolumn-rulelist with a trailing comma, a repeatedhistorical-formsand a bare tag in the@font-facefont-variation-settingsdescriptor. Each is kept as written, and a declaration before such afont-familyorborderstays as the fallback the other browser paints (#1628, #1629, #1630). - An invalid
mask-positioncame out valid, and a mask some browsers read was deleted.mask-position:left 10px topuses the three-value form onlybackground-positionhas, so Chromium, Firefox and Safari drop it, and--minifyprintedmask-position:10px 0, which they read.mask-positionreads the<position>of CSS Values 4, while-webkit-mask-positionkeeps the legacy form browsers read there. Chromium and Safari read the same position in the shorthand,mask:url(a.png) left 10px top, Firefox does not, and--minifydropped it. It is kept as written (#1542). Values every browser drops came out valid, or were kept (#1540, #1627, #1631, #1637).
image-set(url(a.png) 1x 2x)repeats its resolution, and--minifyprintedimage-set(url(a.png)1x), which browsers read. The repeat makes the declaration invalid, as a repeatedtype()does.src:url(a.woff) url(b.woff),@font-facesources without a comma, becameurl(a.woff),url(b.woff), which loads a font Chromium and Safari never load. Such an item is dropped (CSS Fonts 4 sec. 4.3).vector-effect:non-scaling-stroke non-scaling-strokeandnon-scaling-stroke screenwere kept andnon-scaling-stroke viewportrewritten, though SVG 2 sec. 8.13 takes one keyword and browsers drop each. Each goes with a warning.- A declaration holding an invalid substitution call, such as an empty
attr()orenv(), is dropped, even inside avar()fallback or a custom property (content:var(--x, attr())), as CSS Variables 1 sec. 3 requires.
attr(x type(<COLOR>), red)is kept as written instead of respelledtype(<color>), which Chromium applies though it drops the original (#1617).
Values beside a var(), and custom properties
- A percentage beside a
var()became a number.opacity:calc(100% - var(--x))becamecalc(1 - var(--x)), which a browser drops at computed-value time: with--x:30%Chromium shows the source at .7 opacity and the output at full opacity. The SVG opacities andshape-image-thresholddid the same, andcascade diff --diff=canonicalcalled the two spellings identical. CSS Values 4 sec. 10.9 types a calculation by its operands, so a percentage becomes its number only where novar()shares the calculation (#1456). - A product with zero dropped a
var().width:calc(var(--u) * 0px)becamewidth:0, though with--uundefined the source is invalid at computed-value time and Chromium lays the element out atauto. Avar()substitutes tokens, socalc(0 * var(--x))under--x:1px + 2pxis 2px, not 0, and--y:calc(var(--x) * 0)became--y:0.cascade diff --diff=canonical,--inline-varswith a kept variable andCss.Contextruntime variables made the same fold. A zero product drops an operand only when it holds novar(), or is an@propertyregistered as<number>or<integer>(#1457). - A zero blur or spread went before a
var().text-shadow:0px 5px 0px var(--c)becametext-shadow:0 5px var(--c), wherevar(--c)can be the blur: with--c:3pxthe source draws no shadow and the output a blurred one.box-shadow:0 1px 0 0 var(--c)lost its zero spread the same way. Each zero stays before avar()colour, as abox-shadowblur's already did (#1471, #1472). - A value moved or dropped components around a
var().--minifytreated avar()beside other components as one of the property's slots, then filled in, dropped, merged or reordered the slots around it:flex:var(--g) 0pxbecamevar(--g) 1 0,flex:1 1 var(--b)became1 var(--b),gap:var(--a) var(--a)becamevar(--a),list-style:var(--a) nonebecamenone var(--a) none,grid-area:var(--a) / auto / auto,border:var(--a) noneandtransition:var(--a) 0slost their trailing slots,transform:translate(var(--a),0px)lost its second argument,background:red var(--x)moved the colour last, andrgb(var(--r),var(--g),var(--b))lost its commas. Avar()may supply any number of components, commas included (CSS Variables 1 sec. 3), and Chromium renders each pair differently for some value of the custom property. Such a value is written back with every component in place, each still respelled where it stands; avar()that is the whole value or sits inside a math function is unchanged.cascade diff --diff=canonicalcalls such a pair different (#1511). - The space beside a
var()in a math function was dropped.calc(100% var(--op) 10px)becamecalc(100%var(--op) 10px), in a typed declaration and in a custom property. Thevar()may substitute a+or-, which needs whitespace around it (CSS Values 4 sec. 10.8), so with--op: -the first is100% - 10pxand the second is invalid. The whitespace beside avar(),env()orattr()in a math function stays, except next to*,/or a comma (#1510). - A math function over a
var()could delete its declaration.--minifydeletedrotate:atan2(var(--y),var(--x)), the same overacos(),asin()andatan(),rotate:x acos(var(--v))andclip-path:circle(var(--v) 0% 0%)as invalid, and printed the first fromrotate:calc(atan2(...)), so a second pass deleted what the first kept. A declaration holding avar()is valid until substitution (CSS Variables 1 sec. 3), and is kept as written (#1513). - An
@propertyregistration was trusted where another can replace it.@property --n{syntax:"<number>";...}letcalc(var(--n) * 0px)fold to0and--c:rgb(255 0 0)respell asred. A script (CSS.registerProperty()) or a later sheet can register the name again: Chromium computes 1px against 0px for the first under a later universal registration. A registration types its property only under--scope=stylesheet, when it is the last for its name outside any conditional rule. Under--enforce-spec, an@propertymissing a descriptor is kept, since the current specification reads it as a registration (#1481). - A custom property's tokens are written as read, apart from whitespace (CSS Custom Properties 1 sec. 4.1):
--minifyrespells no number (1.0), sign (1px+2px), ident case (Red), url quote or colour inside them, does not join#fff url(a.png)into one hash, and folds no math function.--lh:calc(2.25/1.875)became--lh:1.2, but Chromium computesz-index:var(--lh)as1under the first andautounder the second.--diff=canonicalkeeps such spellings apart. A colour built withCss.varkeeps itsoklch()chroma a number, where.188printed as47%(#1567, #1618, #1654).
Math functions and numbers
- Math functions outside a property's range were dropped or broken.
font-size:calc(-1px),transition-duration:calc(-1s),flex-basis:calc(-1%)andfont-stretch:min(-1%,2%)were dropped, andscroll-padding-inline:calc(2px - 3px),gap:calc(-1px),width:calc(1% - 2%),border-width:min(-1px,2px)andzoom:min(-1,2)became a negative literal every browser drops.min-height:calc(-infinity*1px)became-3.40282e38px, which the twelve sizing properties refuse, where the source clamps to0px. A math function past the range is valid and clamped (CSS Values 4 sec. 10.12), so each is kept, folded where it can be, insidecalc(). So is one that folds below zero (calc(-10%)) in the@font-facesize-adjustand metric override descriptors (#1473, #1512, #1625). - Math functions over times, angles and percentages were dropped.
transition-duration:min(1s,2s),transition-delay:abs(-1s),rotate:min(10deg,20deg),opacity:min(10%,20%),zoom:max(10%,20%),border-image-slice:clamp(10%,20%,30%)and the same calls in the transition and animation shorthands,offset-rotate, the SVG opacities,shape-image-thresholdandscalewere refused. Every math function reads wherever its type stands (CSS Values 4 sec. 10.1) and folds to the literal of its value (#1475). - A math function at a number or integer slot was deleted.
--minifydeletedcounter-increment:a calc(1),font-variation-settings:"wght" calc(400),rotate:1 calc(1) 0 45deg,z-index:round(1.5),counter-increment:a sign(1),aspect-ratio:cos(0), which Chromium computes as1 / 1, andopacity:min(calc(1 + 2), 1), acalc()inside another math function. It deleted an@propertyrule whose<number>initial value wascalc(1.5). A call that cannot fold went as well, such asopacity:sign(1em), which Chromium computes as 1, andcounter-increment:a sign(1em). CSS Values 4 sec. 10.1 puts a math function at any slot of its type, sec. 10.3 letsround()omit its step, and sec. 10.9 rounds a result at an integer. A call that folds to a constant is read as that number, rounded at an integer (calc(1.5)is2), and one that cannot fold is kept (#1515, #1568, #1571, #1583, #1584, #1621). - An inverse trigonometric function counted as a number.
opacity:asin(0)becameopacity:0, and the same atz-index,line-height,flex-grow,scaleand insidecalc(asin(0)*1px), thoughasin(),acos(),atan()andatan2()answer an angle (CSS Values 4 sec. 10.4) and browsers drop those declarations.sin(asin(.5))folded to-.98803162, reading the angle's degrees as radians. Such a declaration is dropped, andsin(asin(.5))is.5(#1516). - A comparison over a position percentage was folded.
background-position:min(10%,20%) 0became10% 0, andcalc(min(10%,20%) + 1px)becamecalc(10% + 1px). A percentage inbackground-position,mask-positionorobject-positionresolves against the box less the image, negative when the image is the larger, somin(10%,20%)there is20%of it. A comparison,abs()or a stepped function over such a percentage is kept as written; one whose basis cannot be negative, as intransform-origin, still folds (#1509). - A zero lost its unit inside a line-width comparison.
outline-width:max(0px,var(--v))becamemax(0,var(--v)), which mixes a number with a length and is invalid at computed-value time, across the 27 line-width properties.round(1px,0px)andmod(1px,0px)folded to1px, where CSS Values 4 sec. 10.9 makes both NaN and Chromium computes0px. A zero operand keeps its unit, and a zero step or divisor keeps the call (#1508). - A negative zero in a calculation lost its sign.
opacity:calc(1/-0)printed ascalc(1/0)andz-index:calc(1/sign(-0))ascalc(1/sign(0)), which flips the infinity: Chromium computes-2147483648against2147483647(#1582). calc-size()is read as CSS Sizing 4 sec. 7 gives it. It takes ananybasis,sizeinside the calculation's math functions (calc-size(auto, round(size, 10px))) and a sizing function such asfit-content(10px)as the basis. It refusessizeafterany, anonebasis and a keyword in the calculation.flex-basistakescalc-size(content, ...). Theflexshorthand refuses acalc-size()basis by default, since no shipping engine paints it, and keeps theflexbefore it; under--enforce-specit reads it, as CSS Flexbox 1 sec. 7.1 givesflexthe<'flex-basis'>grammar (#1622, #1623).- Huge numbers lost digits.
--minifyprinted a number from 2^62 up, or a fraction from about 4.6e10 up, with 12 significant digits:46116860184.27387904pxbecame46116860184.3pxand123456789012.5pxbecame123456789012px. A browser clamps such a length, but it adds acalc()'s operands first, socalc(123456789012.5px - var(--b))with--b:123456789012pxrendered 0px wide instead of half a pixel. Such a number prints the shortest digits that read back as its value (#1550). - An integer past the native int range is kept at the end of the range instead of dropping the declaration (CSS Values 4 sec. 5.2):
z-index:99999999999999999999, counters, grid lines,:nth-child()and@counter-stylefixed. A value folded at an integer slot prints as an integer token, socounter-reset:c calc(1e20)does not becomec 1e20, and an untyped value's number token keeps its type (widows:2.0stays as written) (#1619). - A number beside a substitution keeps its digits.
--minifyprintedcalc(.123456789px*var(--k) - 12345678px)with.12345679px, and with--k:100000000Chromium computes the two as .890625px and 1px. A factor beside an unresolved one, a divisor holding one, and an argument ofpow(),exp(),round()and the other math functions that amplify an unresolved argument now keep their digits; every other number keeps the eight-decimal budget (#1645, #1651).
Colours
- A
color-mix()of one colour or of three was mishandled. CSS Color 5 mixes any number of colours, and Firefox 150 reads them.--minifyread the first two ofcolor-mix(in srgb,red,blue,green)and folded them topurple. It refusedcolor-mix(in srgb,blue), soa{color:red;color:color-mix(in srgb,blue)}becamea{color:red}. Both mixes stay as written, and thecolor:redbefore the second stays for the browsers that drop it, Chromium 153 among them. Under--enforce-speca mix of one colour folds: CSS Color 5 sec. 3.3 makescolor-mix(in srgb,blue 40%)the colour with its alpha scaled,color(srgb 0 0 1/.4), and--diff=canonical --enforce-specreads the two as one value (#1465, #1483, #1600). - A colour changed the way it blends.
linear-gradient(color(srgb 1 0 0),color(srgb 0 0 1))becamelinear-gradient(red,#00f), and Chromium paints the middle of the first (139,83,162) and of the second (127,0,128): CSS Color 4 interpolates a hex, a name,rgb(),hsl()andhwb()in sRGB and every other colour in Oklab. The same fold to hex changed transitions, animations andcolor-mix()overcurrentcolor, and so did readingnoneas zero, since an interpolation gives a missing component the other colour's. Anoklch(),lab()orcolor()colour stays in its notation, rounded within the same budget, and a staticcolor-mix()folds to a colour of its interpolation space (color(srgb .5 0 .5)forcolor-mix(in srgb,red,blue)).noneis kept, inhsl()andhwb()too, and as an alpha:rgb(0 0 0 / none), transparent at rest (CSS Color 4 sec. 4.4), does not minify to the opaque#000. A negativelch()oroklch()chroma clamps to zero at parse (sec. 9.3).cascade diff --diff=canonicalcalls those spellings different, and tells anonealpha from an opaque or a zero-alpha colour. The SatCSS sheets minify as before; Tailwind's output keeps itsoklch()palette, about 3 KB larger raw and 0.7 KB under gzip (#1549, #1612). - Colour functions are read as CSS Color 4 gives them. The legacy comma-separated
rgb()andhsl()syntax has its own grammar (sec. 5.1 and 7.1): it takes nonone,rgb()takes three numbers or three percentages, andhsl()takes percentages and a comma alpha, socolor:blue;color:rgb(255,0%,0)does not becomecolor:red. A math function at a colour channel is read and folded (CSS Values 4 sec. 10.1 and 10.10):rgb(calc(10%) 0 0),hsl(calc(10deg) 50% 50%)andlch(50% 30 calc(10deg)), which browsers apply, were deleted, and a foldedrgb()channel rounds as its literal does. Conversions use the Editor's Draft D50 white (x 0.3457, y 0.3585) and its Bradford matrices, so sRGB white is achromatic:lch(from #fff l c h)islch(100 0 0)(#1613, #1615, #1616). - A colour takes its shortest spelling that paints alike. A
lab(),lch(),oklab(),oklch()orcolor(srgb ...)colour was rounded to the nearest value at each precision, solab(53.29 -12.26 -44.56)kept two decimals: the nearest one decimal leaves the sRGB gamut. Each coefficient may round down or up, at no more decimals than before, and the colour takes the shortest spelling that paints the same bytes within the 0.002 OKLab budget, herelab(53.3 -12.3 -44.5).oklch(62.8123% .12345 29.23)prints asoklch(.628 31%29). A wide-gamutcolor()keeps the nearest rounding (#1649). - A wide-gamut colour folds to what Chromium paints. Chromium converts the
color()spaces other thansrgbin 32-bit floats with a 2.2 power fora98-rgb, socolor-mix(in a98-rgb,red,blue)paints a red of 128 where CSS Color 4 computes 128.518 and its folded colour paints 129. A fold or a rounding now keeps the bytes both arithmetics give, or the call stays (#1655).
Gradients and images
- Prefixed gradients changed direction.
--minifyread-webkit-linear-gradient(top,...)as the unprefixedto top, and took an omitted direction forbottom, so it printed-webkit-linear-gradient(0deg,...)for both. A prefixed gradient's side keyword names the side it starts from (CSS Image Values 3, Working Draft of 17 February 2011, sec. 5.1.1). This is the difference 1.3 finds most often in 1.2.1's output of the SatCSS corpus (#1418). - Legacy prefixed images were deleted or rewritten.
--minifydeleted-webkit-radial-gradient(center, ellipse cover, red, blue), the prefixed syntax with its position first, and every-webkit-cross-fade(a, b, 50%), in each property that takes an image. Chromium paints both. It read-webkit-radial-gradient(circle at center, red, blue), which Chromium drops, as the unprefixed syntax, and printed a gradient Chromium paints. It deleted the-moz-spelling of the first, which Firefox 160 paints, and kept that of the second, which it drops. It also deleted-moz-radial-gradient(in oklab,red,blue)and-moz-linear-gradient(to bottom,...), which Firefox paints. The-webkit-,-moz-and-o-radial gradients read the 2011 syntax (CSS Image Values 3 WD sec. 5.2.1, Compatibility Standard sec. 3.3.2), and-webkit-cross-fade()reads as Chromium reads it. A-moz-gradient takes Firefox's interpolation hints and methods, and itstodirection keeps the unprefixed meaning Firefox gives it. A form one engine reads is kept for that engine: Firefox's hints and methods in-webkit-radial-gradient(), and Chromium's missing comma after a radial shape and size, kept missing so Firefox still drops it.-webkit-radial-gradient(10px 20px red,blue), which no browser reads, is not rewritten into one they paint (#1533, #1604, #1605, #1606). - Gradients over a
var()changed.linear-gradient(to top,var(--a),var(--b))becamelinear-gradient(var(--b),var(--a)), which with--a:red 20%puts the red at the other end, since a variable can hold a position or several stops.linear-gradient(red,var(--a) 100%)lost its100%, which with--a:red 10% 20%turned a gradient Chromium drops into one it paints.radial-gradient(circle var(--r),red,blue)becameradial-gradient(circle,var(--r),red,#00f), a gradient over three stops where the source sizes the circle. A stop whose colour is avar()is not reversed or stripped of a position. A radial prelude the reader cannot finish keeps the whole value as written, since the comma after a prelude is omitted only with the prelude (CSS Values 4 sec. 2.6) (#1490). - Conic gradients placed by angles were deleted.
--minifyrefusedconic-gradient(red 0deg,blue 360deg),conic-gradient(red 0,blue 1turn), the same afterfrom 90deg at 0 0andconic-gradient(red calc(10deg + 5%),blue), which Chromium paints, and keptconic-gradient(red 10px,blue), which it drops. A conic stop is placed by one or two angles or percentages,0or a math function of both, never by a length, and a conic hint by one (CSS Images 4 sec. 3.3.2 and 3.5.1). A first stop at0degand a last at360deglose the position they take by default, and an angle that is a whole percentage of the turn takes the shorter spelling:90degprints as25%(#1491, #1534). - A gradient whose interpolation hint is not between two colour stops is invalid, as CSS Images 4 sec. 3.5.1, Chromium and Firefox say, so
--minifydrops it (#1607).
Strings, counters and generated content
- Strings and urls came out unescaped.
quotes:'"' '"'andquotes:'""' ''both printedquotes:"""""", which Chromium drops, and a backslash or a newline in aquotesstring was written raw. The same held forimage-set()strings andtype(),clip-path:url(),@font-facesrcurls andformat(),@namespaceurls, and a custom property'surl()holding a tab, which came out bare;@import '"x".css'printed@import "x".cssunminified. A registered<custom-ident>lost its escapes, soinitial-value:a\ bbecamea b, and Chromium dropped the@propertyrule. Every string, url and registered ident is written escaped (#1460). - A
@counter-styleimage symbol became text.@counter-style c{system:cyclic;symbols:url(a.png)}minified tosymbols:"url(a.png)". Chromium supports no image symbol and drops the source's descriptor, so its list falls back to decimal, but it keeps the output's string and draws the texturl(a.png)as the marker. A symbol is a string, an image or an ident (CSS Counter Styles 3 sec. 3.1.7), and each prints as the kind it was written as (#1461). counter()andcounters()with a counter style were dropped.content:counter(n,upper-roman),counter(n,c),counter(n,disc),counter(n,none)andcounters(n,".",lower-alpha)were refused, where Chromium draws each one. CSS Lists 3 sec. 4.6 gives both functions an optional<counter-style>, a counter-style name orsymbols(); it is read and printed, and the defaultdecimalis left out (#1462).contentwith an alternative text was dropped.content:"a" / "b",content:url(a.png) / "b"andcontent:counter(n) / "b"were refused, where Chromium draws each. The alternative text after the slash (CSS Generated Content 3 sec. 1.1), withattr(),counter()andcounters()in it, is read and printed, and a value holding one keeps thecontentwritten before it for browsers that predate it (#1474).
Other values
- Values changed.
animation:"none" 1s, which runs the@keyframesnamed"none", becameanimation:1s.env(--branding-padding 2)becameenv(--branding-padding2), another variable.width:4611686018427387904pxcame out negative andz-index:calc(1e30)as-1.@media (aspect-ratio:1.5/1)was rounded to1, and123456789.12345679to123456789.1234568. A quote insidelocal("...")ended the string early. Each prints a value that reads back as the one written (#1280, #1300, #1351, #1368, #1369). Declarations Chromium reads were deleted. Each value below is read (#1498, #1499, #1500, #1514, #1521, #1522, #1523, #1535, #1626).
position-try:flip-xandposition-try-fallbacks:flip-y flip-block, the physical tactics beside the logical ones (CSS Anchor Positioning 1 sec. 6.1).columns:10px 2/5pxandcolumns:0/0, which give a column height (CSS Multicol 2 sec. 4.5). Acolumnsbefore one stays as the fallback Firefox and Safari paint.animation-range:scroll,animation-range-start:scroll 10%and ascroll 50%keyframe, thescrolltimeline range (Scroll-driven Animations 1 sec. 3.1).scrollbar-gutter:both-edges stable, in the other order CSS Overflow 3 sec. 5.2 grants;offset:content-box auto, a reference box with no shape before an offset distance or rotation (CSS Motion Path 1 sec. 2.1 and 2.6); andoffset:none -1px, a negative distance in the shorthand, whichoffset-distancealready took (sec. 2.2).contain-intrinsic-size:0 auto, which Chromium reads as0. No specification grants the form and Safari drops it, so it is kept as written, and a declaration before it stays as Safari's fallback.line-height:min(calc(1em + 2px),1px)andmax(1em + 2px,1px). Each argument ofmin(),max()andclamp()is read as the sum CSS Values 4 sec. 10.2 grants, and arguments of two types are still refused.stroke-dasharray:1 2 calc(3%)and every dash pattern with a math function after its first dash,object-view-box:inset(0 round 4px)and every roundedinset(), andbaseline-shift:1andbaseline-shift:baseline. Chromium reads the number as px, so an earlierbaseline-shiftwon.animation:foo 1s -1s, a form--minifyprinted itself fromcalc(-1s). The delay, the second time, may be negative; only the duration must not be (CSS Animations 1 sec. 3.6).
- A scroll-driven animation ended at the wrong point.
animation-range:entry 10% normalbecameanimation-range:entry 10%, which ends the animation atentry 100%rather than atnormal: an omitted end takes the start's range name (CSS Scroll Animations 1 sec. 6.2). The end goes only where leaving it out says the same (#1470). animation-rangelists were merged side by side.animation-range-start:exit 100%;animation-range-end:cover,entrybecameanimation-range:exit 100%cover,entry, which gives the second animation another start, andcover,entrybesideexit,containbecame three ranges. The shorthand pairs each start with its end (CSS Animations 2 sec. 6.3), so lists of one length compose range by range and lists of different lengths stay longhands (#1496).- A transition of a property named like an easing keyword changed.
transition:ease ease 1stransitions a property namedease, and becametransition:ease 1s, which transitionsall;ease-in linear 1sbecamelinear 1s ease-in, which swaps the easing and the property. A browser reads the first easing keyword as the easing and a second as the property, so such a property prints after its easing,easeincluded (#1497). - An
ellipse()lost a radius.clip-path:ellipse(10px closest-side)becameellipse(10px), which Chromium rejects, andellipse(closest-side farthest-side)andellipse(var(--v) closest-side)broke the same way. An omitted size isclosest-sideon both axes (CSS Shapes 1 sec. 3.1), so the radii drop only as that pair (#1493). - Anchor fallback tactics were reordered.
position-try-fallbacks:flip-start flip-blockbecameflip-block flip-start, which places the box elsewhere, since the tactics compose in the order written (CSS Anchor Positioning 1 sec. 6.1). A name between two tactics, which Chromium rejects, was moved out to make the entry valid. The tactics keep their order and a split entry is refused (#1494). - Anchor-positioned boxes lost their position.
--minifydeletedtop:anchor(50%),top:anchor(top --a),width:anchor-size()and every otheranchor()oranchor-size()with a percentage side, the name after the keyword, or no argument, though Chromium places the box by each (CSS Anchor Positioning 1 sec. 3.2 and 5.1). It keptanchor(width)andanchor-size(top), which Chromium drops. Both functions read the grammar the specification gives, and print the name first (#1532).
Stable output
- Minifying twice gave other bytes than minifying once. With 1.2.1, 69 of the 504 SatCSS sheets and both Tailwind sheets shrank when their
--minifyoutput was minified again, by up to 434 bytes. A merged rule was nested under its neighbour only on the second run,linear-gradient(0deg,red 0%,blue 100%)took two runs to reachlinear-gradient(#00f,red), and a sheet of more than 128 rules got one pass where a smaller one got up to five. The optimiser finishes in one pass at every size, and a second--minifychanges none of the 504 sheets nor Tailwind's output (#1342, #1370, #1395, #1401, #1402, #1403, #1424). - Two spellings of one value merged only on a second run.
a{background:url("i.png")}b{background:url(i.png)}minified to two rules, and minifying that again gavea,b{...}. The same held forcenter centerandcenterinposition-areaandplace-items,flex:1 1 0%andflex:1, a quotedurl()inlist-style,contentandmask,rotate:1 0 0 10degandrotate:x 10deg, two spellings of a colour, acalc()or an unknown property's value,aspect-ratio:calc(2*16/9)besidecalc(16/9*2),contain-intrinsic-inline-size:100E0pxbesidecalc(1e2px), andmask-size:calc(1e2px)beside100px, withbackground-size,tab-size,column-width,columns,overflow-clip-margin, grid tracks andinitial-letter-wrap. One run merges each pair. Anaspect-ratiocalculation folds to six significant figures, asline-heightdoes, and--losslesskeeps it.Css.to_string, which prints without optimising, writes a value as it is held:url("i.png"),flex:1 1 0%andhsl(120deg 50% 50%)stay so, andCss.minifyshortens them. A prefixed copy that spells its twin's value another way, such as-ms-flex:0 0 autobesideflex:none, goes as one spelled alike does, which takes about 28 kB off the SatCSS output (#1469, #1527, #1528, #1624). - A number past eight decimals merged only on a second run.
a{width:33.33333333333333%}b{width:33.33333333%}minified to two rules printed alike, since the printer writes a number to eight decimals while the reader kept every digit. A number read past eight decimals is the eight-decimal value; the SatCSS sheets held 252 such declarations. A colour channel that the digits past eight decimals move across a byte's half is kept as written instead:rgba(0,0,0,0.09999999999999998)paints alpha 25 in Chromium, its space-syntax spelling 26, and 1.2.1 folded both to#00000019and printedrgb(0 0 0/.1)under--lossless; beside avar(), and through--inline-vars, the same alpha became.1. An alpha the fold rounds keeps the byte it paints, sorgb(0 0 var(--b)/.0996)does not become/.1(#1548). - Output shifted for unrelated reasons. Merges that save the same number of bytes were ordered by hash, so a change inside cascade could move the output of a sheet nobody touched. A tie breaks by the shortest result, then by source order (#1355).
- A nested value prints under the sheet's flags:
--enforce-specprintedoklch(.7 76%20)in a border, a gradient stop andoverride-colorswherecolorkept.304, andCss.minify ~rename_custom_propertyrenames avar()inside a border colour (#1614). - The prefixed twin of an untyped value settles in one pass:
mask-position:center, left top var(--x)gained-webkit-mask-position:center,left top var(--x), which the next minify rewrote to50%. The twin is written as its own grammar reads it (#1638).
Which rules merge
- The default objective weighs compressed bytes and bounds merges by distance. With 1.2.1,
--minifymerged rules at any distance, then threw a whole run of merges away when an estimate of the gzip size grew, so near merges were lost with far ones and a short sheet was searched differently from a long one. The default--objective=transferscores every rewrite by an estimate of the compressed bytes it saves, so it takes no factoring gzip would undo, and merges rules with identical bodies only within 128 printed rules of each other. A compressor encodes a repeated declaration in two or three bytes wherever it sits, but a selector moved away from its neighbours stops compressing against them.--objective=rawscores raw bytes and merges at any distance, for output that ships uncompressed. Against 1.2.1 the output is smaller in total, but not on every sheet: 182 sheets shrink by more than 1% raw, about twenty grow by more than 1% under gzip, at most by about 3%, and 27 under brotli, one cnn sheet by about 7%. Those counts were taken while factoring was scored by raw bytes; scoring it by the estimate made the SatCSS output 0.12% smaller under gzip and 0.14% under brotli, and 0.26% larger raw (#1399, #1422, #1423, #1425, #1581). - Distant merges reach further. Two
@supportsblocks of one condition merge. A distant@mediaor@containermerge moves the earlier block down to the later one when the later cannot rise. It may cross comments, a top-level@scopeblock and the rules that define a name and take no part in the order of style rules:@keyframes,@font-face,@property,@counter-style,@page,@font-palette-values,@font-feature-values,@position-tryand@view-transition. A block holding one of those never moves, so a later definition of a name is never hoisted above an earlier one (#1576, #1577, #1590). - Two rules holding only nested rules merge under targets that read nesting (#1575).
- A box shorthand and a side of the same value do not order each other:
padding:1pxandpadding-top:1px, likewisemarginandinset, in the minifier and incascade diff --diff=canonical(#1578). [x=a]and[x=A]are disjoint unless HTML comparesxwithout case (HTML sec. 4.16.2), so rules on them merge past each other (#1579).
Smaller output
- Math functions over two units of one type fold. Units with a fixed ratio convert first (CSS Values 4 sec. 10.7), so
min(1s,1000ms),calc(1s + 500ms),min(1turn,10deg)andmax(1cm,10mm)fold to1s,1.5s,10degand1cm, andline-height:abs(-1px)folds to1px. A call that cannot fold, such asmin(1s,var(--x)), prints bare rather than insidecalc()(#1507). - An unfolded math function at a number slot prints without
calc():z-index:calc(sign(1em))isz-index:sign(1em), and so atline-height,font-weight,order, flex factors,column-countandscale(#1572). - A registered length times zero folds under
--scope=stylesheet:calc(var(--l)*0)becomes0pxfor a<length>registration where the calculation needs a length, as it already did for<number>and<integer>(#1574). - Prefixed copies of widely available properties go.
--minifydropped-webkit-animation-delay:1sbesideanimation-delay:1s, but kept-webkit-flex-grow:1besideflex-grow:1, a prefixed property cascade has no type for. Such a copy goes too when the two values agree, which shrinks the SatCSS output by about 0.7% raw and 0.3% under gzip.--enforce-speckeeps every copy (#1439). - Thirteen more prefixed aliases are shortened and checked.
--minifyprinted-webkit-flex:0 0 autoand-webkit-transform-origin:top leftas written, and kept-webkit-flex:0 1 main-size, which no target browser parses.-webkit-flexand its three longhands,-webkit-order, the four-webkit-border-*-radiuscorners,-webkit-transform-origin,-webkit-transform-style,-webkit-perspective-originand-webkit-backface-visibilityare WHATWG Compatibility legacy aliases, which every target engine parses under the unprefixed property's grammar. They print asflex:noneandtransform-origin:0 0do, and a value that grammar refuses is dropped with a warning. A few SatCSS sheets shrink, most of them under--enforce-spec, which keeps every prefixed copy (#1518). - A legacy alias restating what a shorthand set is dropped:
-webkit-flex-basis:0%or-webkit-flex-grow:1afterflex:1goes like its unprefixed spelling (Compatibility sec. 3.4.1, Cascade 5 sec. 3.1), 162 bytes over 7 of 504 SatCSS sheets (#1603). - A vendor fallback every target outgrew is dropped:
display:-webkit-box;display:flexand a-webkit-linear-gradient()beforelinear-gradient()keep only the standard value when every target browser parses it. A prefix some target still needs, such aswidth:-webkit-fill-availablebeforestretch, stays (#1587). - An overridden
contentgoes.--minifykept both declarations of.a{content:"a";content:"b"}, since a latercontentcan be a value some browser rejects and the earlier its fallback. Every browser reads a string, a quote keyword, a counter,noneor a CSS-wide keyword, so the declaration before one is dropped. So is a normalcontentbeside an important one, in either order (#1417, #1419). - An overridden
text-renderinggoes, since the property is typed (#1440). - A longhand restating a shorthand's omitted initial is dropped, as in
background:0 0;background-image:none(1975 bytes over 62 of 504 SatCSS sheets) (#1596). flex:1 1 <basis>is written as the lone basis (flex:1 10pxisflex:10px, Flexbox 1 sec. 7.1), and a background colour that is transparent black in any spelling (#0000,rgb(0 0 0/0)) is dropped: 208 bytes over 47 of 504 SatCSS sheets (#1599).--enforce-specand--losslessleft merges unmade. A sharedfont-family:"A B"stayed in each rule where lifting it into one saved bytes.--minifyweighed each declaration at its default spelling, which is shorter than the one either flag prints:--enforce-speckeeps a family name's quotes, and both keep an oklch chroma's number where the default writes a percentage. It weighs the bytes the run prints, which changes 21 of the 505 SatCSS and Tailwind sheets under--enforce-specand none under--lossless; default output is unchanged (#1477).@counter-styledescriptors drop needless whitespace:additive-symbols:2 "a",1 "b"andrange:1 2,4 5(#1570).- A basic shape drops a zero
round:inset(0 round 0)printsinset(0)inclip-path,object-view-boxandshape-outside.shape-outsideis normalised asclip-pathandbackground-imageare: amargin-boxbeside a shape goes as the default (CSS Shapes 1 sec. 6.1), and an image gradient's colours are shortened (#1573, #1591). - A conic gradient drops its default prelude:
conic-gradient(from 0deg at center,blue,red)printsconic-gradient(blue,red), andfrom 45deg at 50%printsfrom 45deg. Both stay when avar()leads the stops (#1585). - Minified output drops the space beside a string:
grid-template-areas:"a""b","head head"auto,quotes:"a""b", which Chromium reads as the spaced forms (CSS Syntax 3 sec. 9.1) (#1586).
Formatted output
cascade fmtkept whichever spelling the input used, so one selector printed two ways. It prints::beforefor:beforeandoddfor2n+1(#1357).lab()andoklab()printed a percentage alpha as a number:lab(50% 20 30 / 40%)came out aslab(50% 20 30 / .4). It prints as written, as in the other colour functions (#1370).currentcolorprints in lowercase. It printed ascurrentColoroutside a function. Both printers writecurrentcolor, as CSSOM serialises a keyword and Chrome writes it back (#1648).
Comparing stylesheets
cascade diff --diff=canonical
- Two sheets were called identical when they are not. A sheet could lose a rule or a declaration inside an
@mediablock to a parse error and still compare identical:@media screen{a!{color:red}b{color:red}}against@media screen{b{color:red}}exited 0. That loss counts as unread, as one inside@supportsdoes, and the command exits 2. The comparison also called.o{width:76px}.g,.o{display:none}.p{display:block}.g{width:24px}identical to a sheet that gives an element of both classes a width of 76px instead of 24px, and.a{color:red}@media screen{.b{color:blue}.a{color:red}}identical to the same sheet without its last.a, which on screen paints an element of both classes blue instead of red. A rule inside a condition that repeats an earlier write of its selector is dropped only when nothing,allincluded, wrote the same property in between, inside the block or out (#1312, #1406, #1451). - A guard a newer browser reads was no difference.
@supports (field-sizing:content){a{color:red}}compared identical to an empty sheet, and so did a guard onanchor-name, since no target version reads either. Chrome ships them from 123 and 125, and Chromium 153 colours the link. A target stands for its version and every later one, so a guard is dropped only when every browser at or past the targets fails it (#1463). - A double negation in
@supportswas printed invalid.@supports not (not (display:grid))came out as@supports not not (display:grid), which Chromium drops with its block and cascade cannot read back, and((display:grid) and ((color:red) or (gap:1px))) or (top:0)lost the parentheses around its inneror. Every operand keeps the parentheses the grammar asks of it (#1485). - A list a browser drops whole compared equal to its rules.
a,a:has-slotted{color:red}compared identical toa{color:red}a:has-slotted{color:red}, though Chromium 153 drops the first rule whole and leavesauncoloured. A list whose selectors some target release reads apart compares as one rule, and one no target parses, such as a list holding a-ms-pseudo-element, as no rule (#1487). - A prefixed property was taken for one no browser reads. The WHATWG Compatibility Standard lists
-webkit-mask-box-imageand its longhands as aliases ofmask-borderand its longhands, and the comparison read every listed alias as its property, so it called.a{-webkit-mask-box-image-width:1px}identical to.a{mask-border-width:1px}. No Chromium or Firefox release readsmask-border, and Chromium leaves the prefixed width atautounder the second sheet. The set is a property of its own, and the pair compares different, as it did in 1.2.1 (#1517). - A prefixed value was taken for one a browser reads later. The comparison read every legacy alias as its property whatever the value, so it called
.a{-webkit-background-clip:text}identical to.a{background-clip:text}. Chrome 111 to 119 parsetextonly under the prefixed name and paint the second sheet's box. An alias reads as its property only where every target release that parses one spelling of the value parses the other;-webkit-mask-imageagainstmask-image, which Chrome reads unprefixed from 120, compares different too (#1519). - A guard was decided by its property alone.
@supports (break-before:always){a{color:red}}compared identical toa{color:red}, though Chromium 153 dropsbreak-before:alwaysand leaves the rule unapplied, and so did a guard onwidth:stretch, which Chrome reads only from 138. A guard is true from the first release that parses every production its declaration uses, value included. It is unwrapped only when true, and dropped only when false, in every release from the targets to the newest in the compatibility data (#1484). A sheet differed from its own minified output. With 1.2.1 this check failed on 139 of the 504 SatCSS sheets and on Tailwind's output. The comparison treats as equal each rewrite below, none of which can change a computed value, and all 504 sheets and Tailwind's output compare identical to their
--minifyoutput under both objectives (#1394, #1405, #1409, #1410, #1411, #1412, #1413, #1414, #1415, #1416, #1430, #1431, #1438, #1440, #1441, #1442, #1443, #1450, #1454).- The split of a selector's declarations across rules.
.a{width:1px}.b{width:2px}.c{height:3px}.a{height:4px}equals.c{height:3px}.a{height:4px;width:1px}.b{width:2px}, and.a,.b{speak:none}.a,.b{top:7px}equals.a,.b{speak:none;top:7px}. Two declarations are ordered only where swapping them could change a value. - Longhands against their shorthand.
top,right,bottomandleftequalinsetalso when another declaration sits between them. - An order no element can observe. Two rules that write the same declarations compare equal in either order. So do a normal and an important declaration of one rule (CSS Cascade 5 sec. 6.1), and two rules that write one value through two spellings, as
-moz-transform:rotate(180deg)and-webkit-transform:rotate(180deg)do. - A legacy alias against its property. The WHATWG Compatibility Standard makes
-webkit-flex-growthe same property asflex-grow, so in-webkit-flex-grow:1;flex-grow:2the later write wins whatever the two values and wherever they stand, and a laterflexwrites over both. The comparison equated an alias only with an identical twin in the same rule, so it called instagram's sheet different from 1.2.1's output of it, which keeps-webkit-flex-basis,-growand-shrinkbeforeflex:1 150px. - A declaration no target reads. A
-ms-,-o-or-khtml-declaration,font-smoothandfont-smoothingare dropped from both sides, and a prefixed copy a target needs, such as the-webkit-hyphensof Safari 16.4, is kept on both.--enforce-specturns this off. - A property cascade did not type.
text-rendering,-webkit-touch-calloutand an untyped prefixed spelling such as-moz-transform-originwere taken to write every property, so they held apart rules that write nothing in common. Each writes its own property alone.
- The split of a selector's declarations across rules.
- A rule no browser reads withheld the verdict. The comparison exited 2 on a sheet against its
--minifyoutput when the sheet held a rule over:-o-prefocus,:-moz-submit-invalid,:selected, a misspelt pseudo-class such as:h, or a keyframe selector such as0for0%. Every target drops such a rule, and the warning says so. The comparison judges for the targets, so it does not count the loss or exit 2 for it. Under--enforce-specthe reader keeps such a rule and the comparison reports a sheet that lost it (#1429, #1446). - Three respellings were reported as differences. The comparison exited 1 on
.a.b{color:red}against.b.a{color:red}, on an@keyframesor@font-facerule moved among style rules, and on@media screen{@media (min-width:1px){...}}against@media screen and (min-width:1px){...}, though Chromium renders both sides alike. A compound's simple selectors print in one order, a name-defining rule moves freely among style rules while two of one name keep their order, and nested@mediablocks read as the conjunction of their queries.@media print{@media screen{...}}and a negated query still compare different (#1537). - An initial
list-stylelonghand is its keyword.list-style-image: initialequalsnoneandlist-style-position: initialequalsoutside(CSS Lists 3 secs. 3.3 and 3.5), solist-style: nonematches the longhands a browser expands it to, and--minifywriteslist-style-image: initialasnone(#1593).
cascade diff without --diff
- A colour written two ways was reported as a modified rule.
color:#ffffffagainstcolor:#fffshowed as a rule annotated "(declarations differ in subtle ways)". The default mode compares declarations the way--diff=treedoes. When the two files parse to the same stylesheet, the report says "no structural change; the text differs" above the text diff. It still exits 1, because the default mode counts any difference in the text (#1400). - A changed rule could go unreported. When the other file held two identical copies of its counterpart, pairing one copy claimed both and the change was dropped (#1297).
- A shorthand is compared with its longhands, one longhand at a time.
.a{border:1px solid red}against.a{border-color:blue;border-style:solid;border-width:2px}printed- borderand three+lines; it prints- border-image: none,* border-color: red -> blueand* border-width: 1px -> 2px. A slot the shorthand omits reads as its spec initial value forborder, a single-layerbackground,flexand a singletransition, soborder:1px solidmatchesborder-width:1px;border-style:solid;border-color:currentcolor;border-image:none:--diff=treeexits 0 and the default mode says only that the text differs (#1555, #1596). - The basis
flex:1omits reads by the mode. By default it is0%, as Chrome computes, soflex:1againstflex-grow:1;flex-shrink:1;flex-basis:0%is no structural change; under--enforce-specit is Flexbox 1 sec. 7.1's0, soflex:1 1 0minifies toflex:1and a0%basis is kept asflex:1 0%(#1601).
Warnings, errors and help
The new form of a diagnostic is under Breaking.
- A noisy sheet buried its warnings. A warning already printed for the same file is counted under the first, and a last line gives the total and points to
-v. netflix.com's sheet prints about 40 lines of warnings where it printed nearly 500.-qwas documented and silenced nothing; it prints no warning, and-vprints every one, infmt,apply,pruneand thediffreport (#1332, #1341). - Some messages pointed at the wrong thing. A selector the reader refuses was a
bad value: ...naming no property, and is abad selector: .... A declaration with no value, such as.b { color: }, was reported one column past the}that ends it, and is reported at the}. A bad@font-facedescriptor value pointed at line 1 of a copy of the value, and is located in the sheet (#1330, #1339, #1340). - A mistyped command was taken for a file.
cascade fmtt a.csscomplained abouta.css. It saysfmttis an unknown command and suggestsfmt.--flatten-nestingwithout--minifydid nothing and said nothing, and is noted (#1333). - The help pages are written for a first reading. They group the options by what they act on, give every command examples and describe the
diffreport and its--jsonmembers (#1333, #1335). diff --browserpromised more than it checks. Its help said it reports every computed-style value the two files disagree on. It compares renders pixel for pixel and lists computed values only under pixels that differ, so a value no pixel shows, such as the duration of an animation that never runs, goes unreported. The help says so (#1455).
Parsing
- A colour channel holding
sibling-index()was dropped.color:hsl(calc(sibling-index()*10deg) 50% 50%)went with a warning, as did anyrgb(),hsl(),hwb(),lab(),lch(),oklab()oroklch()channel calculating oversibling-index()orsibling-count(). CSS Values 5 sec. 9 resolves these on an element, so the value is not known when the sheet is read, and Chromium 153 keeps every such colour. The channel holds the calculation, and a colour holding one is not folded (#1644). - A custom property's value could change on the way through. It was printed and lexed again, so
--x:\!importantbecame a lone backslash marked important, and--x:a/**/bbecame--x:a b, another token sequence. The value is the tokens the parser read.'a'and"a"stay one value (#1386). - Deep nesting crashed cascade. Input nesting blocks or functions more than 128 deep overflowed the stack. A value nested deeper is kept and printed back as written, and a rule nested deeper loses its contents with a warning. A selector nesting
:is()more than 100 deep read as an:is()that matches nothing; its rule is dropped with a warning (#1296). - Rules and declarations a browser drops were kept.
[data-x=2], an attribute selector with a number as its value, was kept as[data-x="2"]and so matched elements no browser matches. In an@keyframesframe, an!importantdeclaration or ananimation-*property other thananimation-timing-functionstayed in the output. Atext-renderingvalue outsideauto | optimizeSpeed | optimizeLegibility | geometricPrecisionwas printed back. Each goes with a warning (#1292, #1294, #1440). - A math function of the wrong type inside
calc()was kept.opacity:calc(min(10px,1px) + max(1px,2px))and the same length comparison at a time, a percentage or an angle were kept, andwidth:calc(min(1s,2s) + max(1s,2s))was printed aswidth:3s; browsers drop each one. A comparison,abs(),hypot()or a stepped-value call in a calculation has to carry a unit the property takes (CSS Values 4 sec. 10.1 and 10.9), and the declaration goes with a warning otherwise (#1524). - A percentage Z offset in
transform-originwas kept.transform-origin:50% center 50%was minified into50% 50% 50%, though CSS Transforms 1 sec. 4 makes the third value a<length>and browsers drop it. It goes with a warning (#1525). - A list of images in a counter-style symbol was kept.
@counter-stylereadprefix:url(a.png),noneas abackground-imagelist and kept it, though a<symbol>is one image (CSS Counter Styles 3 sec. 3.1.7) and browsers drop it; the same reading droppedadditive-symbols:2 url(a.png),1 url(b.png)(#1526). - A reference box beside
nonewas kept.clip-path:content-box noneandoffset-path:content-box nonewere kept, though a box pairs only with a shape (CSS Masking 1 sec. 5.1, CSS Motion Path 1 sec. 2.1) and browsers drop both. Each goes with a warning (#1529). - A counter-style range with its bounds reversed was kept.
@counter-stylekeptrange:4 2, though CSS Counter Styles 3 sec. 3.5 makes a range whose lower bound is above its upper one invalid and browsers drop the descriptor. It goes with a warning (#1530). @charsetis read as browsers read it. It warns and goes unless the sheet opens with exactly@charset "UTF-8";, so not after whitespace, a comment or an@layerstatement (#1294).
--inline-vars
- A value could land in the wrong rule.
--inline-varsread.x&underaas the class.xaand folded a value defined there into a rule stylinga.x. It composes a nested rule's selector as CSS Nesting does, and a definition on a selector list reaches a consumer under one of its branches (#1352). - Inlining its own output folded more. A variable that several rules define with one value was kept, then folded on a second run. It is folded the first time. One whose definitions disagree is named:
--x takes different values in different scopes(#1343). - A
calc()around a kept variable was dropped. With--keep-vars,padding:calc(var(--s) * 1)andwidth:calc(var(--s))came out as a barevar(--s), andcalc(calc(var(--s)) * 2)ascalc(var(--s)*2). A variable substitutes tokens, andcalc()is what reads them as one sum: under--s:1px + 2px, Chromium computeswidth:calc(var(--s))to 3px andwidth:var(--s)toauto, and under--s:1px 2pxthe padding goes the other way.Css.Contextruntime variables did the same. Thecalc()stays, as it does under--minify, which drops a nested one only where an@propertyregistration makes the variable one value (#1458).
Windows
- A build gave other bytes on Windows. Numbers printed differently:
3.40282e38pxcame out as3.40282e038px, and100000000000.5as100000000001.cascadealso wrote CRLF line endings in its output and help pages. Numbers print as elsewhere and lines end in LF (#1286, #1291, #1292, #1300). - Local paths were taken for remote URLs.
--inline-importsleft Windows drive paths (C:/a.css,C:\a.css,C:a.css) andfile:URLs alone, and looked a UNC path up under the importing file's directory. It inlines them and checks them against--import-root.cascade diff --browserstarts node without a POSIX shell and finds it onPATHunderPATHEXT(#1291). - The browser checks run on Windows. They find Chrome under
USERPROFILEwhenHOMEis unset, in playwright'sLOCALAPPDATAcache, and installed underPROGRAMFILESorLOCALAPPDATA. The harnesses start node without a shell, so they run undercmd.exe. The fuzz tests require alcobar 0.5.0, whose timeout does not needSIGALRM(#1557, #1558, #1559).
Speed
--minifytakes less than half the CPU of 1.2.1 over the SatCSS corpus, and about a third on Tailwind's stylesheet and on tw's. Each step left the output byte for byte as it was (#1306, #1307, #1313, #1322, #1323, #1324, #1325, #1329, #1344, #1347, #1356, #1361, #1362, #1363, #1364, #1365, #1374, #1375, #1376, #1377, #1378, #1379, #1380, #1384, #1385, #1420, #1421, #1434, #1435, #1436, #1598).cascade diff --diff=canonicaltakes less than a third of the CPU on Tailwind's stylesheet against tw's, and less than half the memory (#1304, #1305, #1308, #1309, #1326, #1327, #1328, #1426, #1447, #1450, #1554).cascade diffdoes not slow with the square of the rules that moved. netflix.com's stylesheet against its own--minifyoutput takes 0.2 s of CPU instead of 1.2 s (#1297).- Parsing is faster, most of all on Tailwind's output, which sits in one
@layer. A sheet ofvar()fallbacks that do not match their property's grammar cost its size squared (#1311, #1314, #1315, #1381, #1382, #1383, #1387). - Printing warnings does not cost the sheet's size per warning. A 2 MB sheet prints its warnings about twenty times faster (#1310).
--profilesays where a run goes.cascade fmt --minify --profileopens with the time spent reading, optimising and printing, names its columns in words and prints one row per factoring run. It countsnested-merge probes, also read asStats.counters.nested_merge_probes(#1301, #1336, #1372).
Library
Css.minifyoptimises and prints in one call, ascascade --minifydoes.Selector.v,Container.vandCss.stylesheetread CSS written in the program (#1299, #1367).Source_indexoffsets drifted by a byte per CRLF, so a tool locating@importin a CRLF file cut statements in the wrong place, and a NUL could makeSource_index.vraise. Offsets and slices index the string you passed, also when it starts with a BOM.Reader.originandReader.original_offsetmap a position in the preprocessed input back to a byte offset in that string (#1285).Selector.specificitycounted a prefixed pseudo-element as a class.input::-webkit-input-placeholderweighed (0,1,1) where Selectors 4 sec. 17 and the browsers give (0,0,2), and so did::-webkit-scrollbarand::details-content. Each counts with the type selectors (#1444).- A selector built in the program is the one the parser reads.
Selector.compound,combineandreshapebuild a selector in the parser's shape, so it equals the selector read back from its printed text (#1342). Css.Context.resolve_urlresolves1:/xagainst the base as a relative path, as WHATWG URL does, since a digit cannot open a scheme (#1291).Properties.is_vendor_prefixedandProperties.legacy_aliassay whether a property is a vendor's own extension and which property a WHATWG Compatibility legacy alias such as-webkit-transformnames (#1480).Values.read_constant_numberandValues.read_constant_integerread a literal number, or a math function that folds to a constant, rounded at an integer:calc(1.5)is2(#1515).- A legacy name alias is its property during evaluation.
transform:revert-layerrolls back to a-webkit-transformin a lower layer,transform:inheritreads an inherited-webkit-transform, andContext.inherited_value,Context.initial_valueandStylesheet.declared_valuesfind either spelling (CSS Cascade 5 sec. 3.1). Property names are read in any ASCII case (#1561). Calc.infinityprints asinfinity.Calc.(infinity * px 1.)printedcalc(3.40282e38 * 1px); it now printscalc(infinity * 1px).--minifystill writes3.40282e38px(#1650).
1.2.1
Parsing
- A
/*! */comment inside a rule is discarded with the rule's other comments instead of being hoisted in front of it, socascade diffno longer reports removed rules on@tailwindcss/formsoutput (#1276).
1.2.0
Many fixes in this release change the CSS cascade emits for input 1.1.0 already accepted, and some are miscompiles that can change how a page renders. If you shipped minified output built with 1.1.0, rebuild it and run cascade diff --diff=canonical old.css new.css, which exits 1 and prints the difference wherever the two are not equivalent. Library callers should start at ### Breaking, where the public module set and the parser entry points both moved.
Breaking
- A calculation whose sum has no consistent type is dropped, as in
width: calc(sqrt(4) - 1px)andborder-width: abs(-1). It was written back as text cascade's own reader refuses (#1151). - A math function takes only the operands CSS grants, so
height: calc(auto),width: min(0, 1px)andscale: abs(-1px)are dropped.width: calc(inherit)printed a liveinherit(#1139, #1144, #1153). Cascade.Properties.font_weight,webkit_line_clamp,zoom,border_image_slice_itemandshape_image_thresholdgainCalc, as those slots read a math function (#1072, #1086, #1124, #1125, #1145, #1148).Cascade.Properties.line_heightgainsMin,MaxandClamp, soline-height: min(120%, 1px)reads, andgrid_linegainsCalc_name(#1126, #1161, #1174).- Column rules and
interest-delaycarry a comma-separated list, socolumn-rule: 1px solid red, 2px dashed bluereads. A caller writing one entry passes a one-element list (#1024, #1053, #1083). animation_range,animation_timeline,timeline_axisandtimeline_insetgain list arms, the timeline shorthands loseNone, andtimeline-scopemoves totimeline_scope(#1050, #1051, #1052, #1074).Cascade.Stylesheet.font_face_descriptorgains_autoarms forfont-style,font-weightandfont-stretch: auto.font-weight: lighterand thefont-techdescriptor are dropped (#1116, #1117, #1118).font_style_range,font_tech_descriptorandread_font_tech_descriptorare gone.tech()insidesrcandfont-tech()in@supportsstill read (#1116, #1117, #1118).Cascade.Properties.tab_sizeholdsNumber of numberwhere it heldInt, sotab-size: 10.5reads. A caller building a literal writesNumber (Num 4.)(#1054).dash_length,animation_iteration_count,font_weight.Weightand the threeborder_image_*items carry anumberwhere they carried afloat(#1021, #1048).flex_basisandborder_widthgainDimensionfor a spelling no typed constructor carries, as inflex-basis: 1e3pxandborder-width: 3dvh(#612, #1023).vertical_aligncarries oneLength of length_percentageandposition_value.Axis_edge_offsetalength_percentage, sovertical-align: 1capreads (#673, #1070).Cascade.Properties.page_size,page_break_value,page_break_inside_valueandborder_image_slicecarry the CSS-wide keywords, as their siblings did (#993, #994, #1004).- Value types gain arms for the rest of their grammar:
content: url(a.png),flex-wrap: balanceandruby-overhang: spacesread. Exhaustive visitors must handle the new leaves (#995, #1013, #1018, #1019, #1020, #1049, #1088). ray_sizenames only the sizesray()accepts,position_try_fallbacksholds typed entries andplace_itemsgains the modifier-first baselines (#549, #725, #1011, #1012).- The
view-timeline,text-boxandcontain-intrinsic-*types carry their optional slots, sotext-box: normalandcontain-intrinsic-width: auto noneread (#668, #669, #670, #671, #1071). -webkit-mask-originand-webkit-mask-clipcarry WebKit's own box vocabulary in place of themask_boxof their unprefixed namesakes (#1087).Cascade.Properties.color_interpolationcarries the colour space. Its sixIn_*constructors are oneInof acolor_spaceand an optional hue method, and a gradient takes every spacecolor-mix()takes (#1177).flex_basis.From_fontis gone, and so areLeft,Rightand theirSafe_andUnsafe_spellings onalign_content, which printed CSS no grammar grants (#658, #1014).Css.filtergainsOmitted of filter_functionandCss.Supports.tgainsGeneral_enclosed, which keep what the reader used to discard (#869, #870).Css.kindgainsRadial_shape,Radial_sizeandPosition_value, andCss.Stylesheet.moz_document_conditiongainsUrl_exact,Domain,Media_documentandRegexp(#461, #508).Css.colorkeeps the origin of a relative colour as a colour.Relative_rgbcarriescolor * stringandRelative_color_mixa pair of them (#313).- Values every browser drops are dropped with a warning, such as a colour outside the final background layer and
gap: -10%.Cascade.Values.read_margin_lengthis new (#1096, #1097, #1101, #1108). - A
var()whose custom property resolves through another keeps its reference instead of taking its fallback, socolor: var(--x, lime)computes the inherited colour as browsers do (#1100, #1102). border-imageandmask-borderfill their slots in any order, soborder-image: 50% noneandround none 30read (#1089).- Browser support comes from the web-features dataset, so a
backdrop-filterfor Safari 17.0 to 17.6 keeps its-webkit-twin.Cascade.Supportis new andCascade.Optimize.targetsaliases itstargets(#1090, #1110, #1111). - An
@supportscondition keeps the property name and value the author wrote, since rewriting them changed what it tested.--minifykeeps the guard and does not decide it (#584, #587, #1092). Css.Supports.simplify_baselineis gone,Cascade.Supports.ppandto_stringgain?verbatim, andCascade.Supports.Declarationcarries the name beside the declaration (#584, #1092, #1095).- Implementation modules are not reachable through accidental
Cascade.*aliases any more.Cascade.Readeris the character cursorLexerdrives and does not read CSS (#496, #497, #499, #501, #514, #539). Declaration.ppandDeclaration.to_stringreplacepp_declarationandstring_of_declaration, andCascade.Parser.string_of_componentsreplacesParser.to_string_custom(#544, #806).Container.readandMedia.readover a cursor replaceof_components,Css.Stylesheet.statement_declarationsreplacesCss.statement_declarations, andCss.vars_of_stylesheetreplacesCss.vars_of_rules(#348, #382, #509).- The
Css.Transform,Transform_origin,Perspective_originandAnimationstring parsers are replaced by the main readers, andCss.Selector_summary.clear_memois gone (#504, #548). Css.Stylesheet.layer_nameis the identifiers of a<layer-name>, andCss.Stylesheet.edit_statementscallbacks returnKeep,ReplaceorDropof the newCss.Stylesheet.edittype (#442).Declaration.declarationis a private variant. Its constructors still match, but values are built withDeclaration.v(#527).Css.Supports.propertyandCss.Declaration.custom_propertyraiseFailureon text that does not write back as the one declaration they name (#421, #428, #459).- A helper whose CSS value needs a non-empty list raises
Invalid_argumenton[],Declaration.of_stringraisesCursor.Parse_erroron every refusal, andCss.Selector.of_string ""raisesError.Parse_error(#528, #535, #691). Cursor.pairandtriplerewind the cursor when the separator or a later parser fails, so code that caughtParse_errorand read on sees a different position (#509).- New record fields must be set in expressions and bound or skipped with
; _in patterns:recoveryonCascade.Error.t,sourceonCss.parseandin_style_ruleonCss.Pp.ctx(#374, #747, #834). Cascade.Reader.parse_errorgainslineandcol, and itsfilenameholds the source name where it packed"<CSS input>:L:C"(#491).Css.Context.querygainsmedia_inapplicable, andTree_diff.Content_changedgainsadded_propertiesandremoved_properties(#723, #868).Css.Media.equalcompares normalised query structure, so it can disagree withCss.Media.compare a b = 0, andCss.Media.kindsortsnot (min-width: 640px)with the upper bounds (#328, #516).cascade diffexits 2 instead of 0 when it finds no difference but dropped a rule it could not read. A refused declaration, which browsers drop too, does not withhold the verdict (#832, #833, #834, #835, #836, #1270).cascade diff --depthis gone, since a report is bounded by whole differences. Pass--limit=nonewhere you passed--depth=max(#792).cascaderequirescmdliner >= 2.0.0, the release that lets either side name standard input as-(#796).
Parsing
- A math function reads wherever the grammar allows its type, with no
calc()wrapper, sofont-weight: calc(400),width: abs(-1px)and the@font-faceoverride descriptors read (#1145, #1148, #1164). - A value a browser rejects is rejected whole, such as
translateX(10px red). The prefix cascade recognised used to survive (#417, #617, #627, #629, #631, #673, #680, #688, #699, #701, #878, #882, #890, #891). - A property refuses what its grammar refuses, so
zoom: -1,font-style: oblique 0and a percentage@page sizeare dropped (#982, #1001, #1002, #1003, #1004, #1005, #1006, #1007, #1010, #1015, #1077, #1163, #1165, #1166). - An empty value is a declaration only for a custom property, and
color-scheme: light only darkis dropped.Cascade.Properties.read_border_image_sourceis new (#640, #1000, #1009, #1078, #1169). - A
<custom-ident>refuses the reserved names in any case.animation-name: defaultis dropped with a warning andanimation-name: "default"still reads (#1143). - A value list takes the items its grammar grants:
mask: none, noneandfont-family: Cambria Mathread, andbox-shadow: none, noneandfont-family: serif serifare dropped (#1147, #1167, #1171, #1173, #1176). @keyframes "default"keeps its quotes, where it printed as a@keyframes defaultbrowsers drop, and@keyframes "none"reads.color-scheme: defaultis dropped with a warning (#1146).- A
<length>slot refuses a percentage and a sizing keyword, and a<time>or<angle>needs its unit, soborder-width: 50%androtate: 0are dropped (#871, #879, #880, #951, #952, #953, #954, #1056, #1058, #1059). - Selectors and at-rule conditions browsers accept are read where they were dropped, such as the
svg||tdcolumn combinator,:dir(auto)and astyle()range query (#335, #427, #461, #551, #572, #594, #805). white-space: collapse,animation-duration: autoand other text, list and animation values browsers accept are read (#646, #665, #666, #682, #874, #877, #885, #886, #889, #995, #998, #1022).- Layout values browsers accept are read too, such as
grid: none / 200px,place-items: flex-start baseline,row-gap: normalandoutline: thin solid red(#456, #633, #739, #881, #884, #909, #1055, #1122). - An empty
blur()reads, and so does a CSS-wide keyword at thepage-break-*aliases andborder-image-slice(#334, #579, #644, #667, #827, #870, #887, #993, #994, #1060, #1085). - A value is checked against the range its specification gives:
offset-distance: -10pxandz-index: calc(.5)read, and a math call keeps its wrapper under--minify(#996, #999, #1026, #1047, #1080, #1082, #1123). - Each grid property reads its own grammar.
grid-template-columns: [a]andgrid-column-start: 0are dropped, and a track size accepts math resolving to<flex>(#708, #711, #712, #714, #717, #718, #724, #749, #1016, #1076). font-variantis typed, thefontshorthand reads all nine width keywords, and a badsrcitem no longer costs the whole@font-face(#695, #963, #964, #965, #972, #1115).@counter-styledescriptors are checked against their grammars.range: bogusandpad: 3are dropped, and a counter symbol may be an image (#1130).- An
@propertyrule is dropped when itssyntaxcannot be honoured or itsinitial-valueholds avar(),attr()orenv(). Two syntaxes that hung the parser read (#398, #707, #710, #713, #1142). - An
@propertyinitial-valuerefuses a length that needs an element, such as3em, under any syntax but the universal one, which stores the value as written (#1179). - A bad nested rule, a stray
;or leftover tokens after a value are dropped on their own and the style rule around them survives (#374, #380, #384, #388, #392, #727, #895, #897, #974). - A bad descriptor, margin at-rule or
@scopebound is dropped on its own, and the at-rule around it keeps the rest of its block (#399, #402, #403, #404, #405, #419, #420, #946, #948, #949). - An unrecognised at-rule keeps its block, an unknown
@supportsor media condition keeps its guard, andOptimize.drop_unknown_at_rulesdrops such rules on request (#469, #483, #867, #869, #947, #977). - A selector no browser can match is dropped:
. x aused to read as.x a.Css.Selector.of_stringrefuses a string that is not a selector (#418, #426, #430, #441, #552, #553, #556, #559, #950, #976, #982). - A
var(),env()orattr()is kept inside another function as it is at the top level. A value with an unmatched),]or}is dropped with a warning (#511, #518, #726, #729, #734, #735, #787, #813, #978, #997). - A
var()the evaluator cannot resolve keeps its reference instead of taking its fallback, and--inline-varskeeps it live unless its definition provably applies (#985, #986, #987, #988, #989, #990, #991, #992). - Keyword, at-rule and function names match in any case, so
@MEDIAandRGB()read. An escape reads as what it spells, and@layer a\2e bnamesa.b(#437, #442, #602, #603, #604, #620, #622, #767, #1141, #1162). - Cascade reads back what it writes. Minified
@scope to (...), a negativerotateaxis, a relative colour's channels and a-webkit-gradientsurvive the round trip (#656, #898, #899, #900, #902, #903). - An unterminated string, a keyword-shaped keyframe name, an at-rule body ending on a backslash and a
url(at end of input survive the round trip too (#558, #875, #876, #894, #896, #901, #910, #911, #912, #913, #1155). - A relative colour's channel expressions are type-checked, so
rgb(from red calc(r + 10%) g b)is dropped as browsers drop it, and a percentageoklab()lightness clamps (#904, #905, #1061). - The
offsetandposition-*properties andwhite-spaceread their own grammars, so a built and a parsed value compare equal (#478, #485, #495, #651, #652, #653, #654, #657, #674, #683, #888, #935). - An input that ends mid-value keeps its declaration, where it swallowed the rest of the sheet, and
--x: 1 ! importantis important with the value1(#972, #973, #979). - Everything the parser repairs or drops is reported, so strict mode rejects it.
@media screen {swallowed the rest of the file and returnedOkwith no warning (#466, #472, #473, #477, #484, #538, #789, #793, #801). - A parse error points at the value the author wrote, and
Cascade.Reader.intraisesParse_erroron a fractional or out-of-range number instead of truncating (#496, #497, #499, #501).
Printing
text-decoration,mask-border,animationandmasknever minify to an empty value such astext-decoration:, which no parser reads back (#682, #955).- An identifier prints with the escapes it needs to read back.
@layer a\3b bprinted two statements and--x\3b ytwo declarations (#435, #436, #526, #598). - A compound operand in a
@mediacondition keeps its parentheses, and unwrapping a@supportsnested in a style rule keeps the;before the next sibling (#319, #370). - A relative colour's channel list and a
rotateaxis after avar()angle print in a form that reads back as the same sheet (#1189). - A comparison function's operand prints as written:
border-width: min(var(--x), 1px)gains nocalc()around the reference (#1175). - A
calc()printed without--minifykeeps the parentheses the author wrote, and--minifykeeps only the ones precedence needs (#721). - A NaN prints as
calc(NaN)orcalc(NaN * 1unit).calc(sqrt(-1) * 1px)printedNaNpx, which browsers drop (#425). Css.to_stringrenders the sheet once instead of twice (#479).
Minification
- A colour folds only to the bytes a browser paints:
color(display-p3 .5 .5 .5)is not folded togray, and a colour outside the sRGB gamut keeps its spelling (#1272). - A relative colour whose channels are its own space's keywords in order folds to its origin, so
oklab(from rgb(0 0 0 / .1) l a b / 20%)minifies to#0003(#1248). calc(.5 * 100%)inflex-basisfolds to50%andcalc(infinity * 1px)to3.40282e38px, so canonical diff reads Tailwind's spelling and lightningcss's as one (#1244, #1245).- A pixel
stroke-widthminifies unitless,stroke-width:1pxtostroke-width:1, and a signed number in a token stream drops its leading zero,-0.5to-.5(#1242, #1243). - A registered
<length>zero minifies to0in an@propertyinitial-value. Canonical diff reported two equivalent registrations as different (#1237). - Adjacent
@mediablocks with one condition merge even when a body holds aprefers-color-scheme,prefers-contrastorprefers-reduced-motionquery (#1233). - A shorthand holding a
var()keeps every component, wherelist-style: disc outside var(--x)becamelist-style: var(--x). Rebuild minified output with avar()inlist-styleortext-decoration(#1194). - A math call a property's range keeps folds its arithmetic first:
width: calc(-5px - 5px)printscalc(-10px)(#1181). round()sends a tie toward positive infinity.round(-3, 2)folds to-2where it folded to-4(#1182).sign()folds only when its argument's sign is settled:calc(10px * sign(-1em))keeps its call andsign(-1px)still folds (#1180).- One
--minifypass reaches its final output where a second pass changed it again, soa{width:1.0px}b{width:1px}merges at once (#1150, #1158, #1159, #1160, #1178, #1185, #1186, #1187, #1188, #1190). --minifycontracts longhands into the box, border,border-radius,border-image,background,mask,columnsand grid shorthands (#915, #916, #918, #920, #921, #922, #926, #927, #933, #935, #939, #942, #960, #961).- The
offset,text-decoration,flex-flow, timeline,container,white-space,text-wrapandfontshorthands contract too (#923, #924, #925, #928, #929, #930, #931, #932, #937, #965). - A component at its initial value is the slot its shorthand leaves out, so
flex: 0 0 autominifies toflex: none, and a repeated side folds to the shortest spelling (#917, #919, #934, #940, #959). - A longhand that restates the shorthand before it is dropped. A border family written out in full minifies to
border: 1px solid red(#956). - Contraction resets no longhand the run did not write, so contracting a partial
transitionoranimationrun needs--scope=stylesheet(#843, #845, #914, #957, #958). - Contraction skips a run holding a CSS-wide keyword, which turned four paddings into a
paddingbrowsers drop, and keeps a neighbour'sborder-image(#943, #968). Css.Propertiesgainsbackground-position-xand-y, thecolumn-rulewidth and style longhands,white-space-collapse,column-heightandcolumn-wrap(#926, #927, #928, #936, #938, #941).- A value keeps every digit and unit the author wrote unless a shorter spelling is the same number, so
.4285714emkeeps its precision (#350, #354, #362, #367, #676, #685, #731). - A
calc()below zero keeps its call where the range starts at zero.width: calc(-10px)was folded to-10px, which browsers drop (#967, #1149). - A sum leads with a positive term, so
calc(-10px + 100vw)minifies tocalc(100vw - 10px)(#1113). - Rules that differ only in how they spell a hex colour, a NaN, an unreduced
min(), a wide-gamutcolor-mix()or a same-unitcalc()merge under--minify(#471, #482, #597, #618, #624, #647, #678, #755, #756). - So do rules that differ by a shorthand component at its initial value, a repeated
font-familyentry, a logical minimum size orsteps(1)(#635, #636, #637, #639, #640, #641, #650, #672, #675, #681). --minifykeeps a value whose shorter spelling would mean something else, such asdisplay: block rubyandtransition: opacity 0s 2s(#387, #390, #401, #457, #470, #547, #633, #634, #637, #736, #766, #782, #803).--minifydrops the space at a%or)boundary in the box shorthands andinset(), and prints a custom property as the author's token stream (#614, #619, #623, #697, #700, #703, #709, #719, #720, #722).- A selector rewrite that changes what an element matches is gone:
.c:not(:enabled), a single-argument:is()and a double:not()keep their form (#377, #431, #593, #596, #655). @mediaand@containerblocks merge by query structure, adjacent@starting-styleruns merge, and@media not all and (X)minifies to@media not (X)(#323, #465, #516, #519, #585, #592, #809).- A declaration keeps its place when moving it would change what an element computes (#352, #364, #376, #383, #386, #414, #415, #447, #452, #453, #454, #742).
--minifyoptimises inside every at-rule with a body,@-moz-document,@starting-style,@whenand@elseincluded (#341, #343, #344, #349, #372, #374, #389, #396, #560).- Flattening emits only selectors a browser can match. A rule under a pseudo-element is dropped, and
a { .x& { } }becomes.x:is(a)where it became.xa(#759, #800, #818, #822, #823, #975). - Default minification adds the WebKit fallbacks Safari 16.4 and Chrome 111 need, and drops a vendor prefix only when its unprefixed twin is Baseline widely available (#325, #378, #447, #751, #758, #797, #1256).
Css.Resolvematches an attribute selector as an HTML document does, folding names and the values of case-insensitive HTML attributes to lowercase (#944, #945).- Computed-value evaluation resolves
inherit,initial,unset,revertandrevert-layerfor every typed property (#763, #764). --minifyis several times faster on a large stylesheet for the same output. The worst sheet of the SatCSS corpus drops from 3.5s to 0.6s (#1183, #1184).- A long run of rules sharing one selector does not allocate quadratically under
--minify(#413, #422, #468, #480, #486, #487, #493, #502, #505, #507, #523). cascade diffis faster on a large stylesheet too, and a 4,000 statement sheet is linear (#424, #517, #519, #542, #543, #566, #664, #746, #750).
Custom properties
Css.inline_vars ~inline_runtime:trueinlines a reference marked~runtimewhen the sheet defines its variable once, as tw's--inlineneeds (#1238).- A custom property's value, a container or media query and an
@supportscondition keep the whitespace and escapes the author wrote (#1064, #1065, #1066, #1067). Cascade.Token.tgainsrepr,Cascade.Token.Whitespacecarries its run, andCascade.Parser.to_string_verbatimwrites the authored text back (#1064, #1065, #1066, #1067).Css.inline_varsandCss.custom_propsreach avar()in every at-rule, descriptor and nested rule (#322, #341, #342, #375, #423, #555, #571, #573, #575, #577, #1048).Css.inline_varsresolves a property defined across cascade layers by the sheet's layer order, and keeps the@propertyrule of a custom property it leaves live (#357, #371, #373, #416).- Substitution keeps a custom property's layer and metadata, a
page-break-*declaration and a runtime marker, and reports an overridden variable through~warn(#315, #506, #520). @scope { color: green }reads, and an at-rule inside a keyframe or descriptor block costs only itself, where it cost the rest of the block (#1068, #1069).--minifykeeps the quotes on a<string>in a custom property whose@propertysyntax takes only an ident, and the spaces of a<type>+initial value (#626, #704).- A custom property holding only whitespace holds the empty value:
--x:minifies to--x:, andCss.Declaration.custom_propertytrims to match (#1157). Css.resolve_themecovers declarations in@keyframes,@page,@position-tryand@supports, and binds a name that needs escaping instead of refusing it (#317, #324, #327, #421, #439).Css.inline_varsis linear in at-rule nesting depth, and a 12,800-variable sheet is no longer quadratic in the variable count (#481, #568, #569).Css.Variables.read_reference_bodyreads avar()argument list into a typed handle, andtyped_custom_propertywrites a declaration from an@property-typed value (#626, #630, #642).
Canonical diff
- Two sheets that set the same layer order in the same places compare equal, whether they write it as one
@layer a, b;, as per-layer statements or by block order (#1262, #1275). - An
@supportsblock whose guard no browser can answer yes, such as Tailwind's@supports (@media(width>=1px): var(--tw)), compares as nothing.Supports.never_holdsis the test (#1270). - A
color-mix()or relative colour overlight-dark()is thelight-dark()of that operation on each branch, socolor-mix(in oklab, light-dark(red, #00f) 50%, #0000)equalslight-dark(#ff000080, #0000ff80)(#1270). - An angle compares as degrees, so
.5turnand180degare one angle. A colour function in a custom property reads a missing axis as zero, sooklab(0% none none/.5)equals#00000080(#1270). --diff=canonicalis several times faster on a large stylesheet. Comparing tw's site sheet with Tailwind's compiled one drops from 22s to 5.5s of CPU (#1267).- A move is reported only when the moved rule conflicts with a statement it crossed. Swapping rules under
@media (X)and@media not (X)is not a move (#1246, #1263). - Rules grouped into different
@media,@supportsor@containerblocks, or a named@layerblock placed elsewhere among unlayered rules, are not a difference (#1259). - A nested
&:where(.dark, .dark *)undersvg *flattens tosvg :where(.dark, .dark *). The pair was reported as a selector change (#1257). --diff=canonicaljudges for the evergreen browsers--minifytargets, so a guard, prefix or colour fallback they all treat alike is no difference.Css.optimizegains?judge(#1256).- A non-terminating quotient compares to six significant figures, so
calc(1/3 * 100%)and33.3333%are one width.Values.calc_ctxgains abudgetfield (#1255). - A declaration a
@media,@supportsor@containerblock repeats from the rule with the same selector just before it is not a difference (#1254). - Two conflicting declarations swapped inside one rule are reported as that rule's reorder, where the report fell back to a byte diff of the two forms (#1251).
- A negated range bound equals the opposite bound:
not (width >= V)and(width < V)compare equal, and--minifywrites the shorter (#1250). - A
<time>in an unregistered custom property compares as its duration:--d:.1sand--d:100msare equal (#1247). - Declarations in a
@keyframesframe compare in canonical order, as a style rule's do (#1241). - Nested
@mediablocks compare by the conditions around each rule, so two nesting orders of the same blocks are equal (#1240). - A
var()fallback compares as the typed value it substitutes into, a shadow's colour slot included, sorgb(0 0 0 / .1)andrgb(0 0 0/.1)match there (#1231, #1232). - An
@containerstyle()orscroll-state()query compares the same in any case (#1226). - A legacy
-webkit-alias the WHATWG Compatibility Standard names reads as its unprefixed twin, soa{-webkit-transform:none;transform:none}equalsa{transform:none}(#1200). - Rewrites that cannot change what a browser computes are equal, such as a shorthand against its four side longhands and
calc(28/14)against2(#475, #655, #753, #756, #775, #776, #777, #842). - A colour compares as a colour wherever it is written, a
nonechannel and a relative colour's origin included, and so does a one-word font family (#312, #313, #314, #440, #696, #705, #847). - Only reorderings present in the inputs are reported. A changed declaration used to make a neighbour look moved (#779, #780, #781, #819, #825, #826, #831).
- A nested sheet and its flat form are identical. Nesting is flattened and the rules inside every at-rule block are normalised before comparing (#393, #529, #576, #760).
--diff=treecompares values on their minified spelling, prints an added or removed rule's declarations, and pairs a repeated selector by its properties (#702, #706, #752).cascade diffdoes not abort when a reordered selector has the same rule index on both sides (#582).
Library
Browser_compare.runincascade.browserruns the comparison behindcascade diff --browseron two sheets, andBrowser_compare.identicalis its verdict (#1260, #1268, #1274).Css.add_var_fallbacksgives eachvar()with no fallback the value a lookup answers, so a sheet whose tokens are declared elsewhere still resolves them (#1236).Css.to_stringandCss.to_buffertake?rename_custom_property, one function that renames each custom property where it is declared and in everyvar()(#1235).Cascade.Source_indexlocates each at-rule and function token by byte offset, so a tool can splice the author's bytes at boundaries the parser supplies (#1234).Cssbuilds every property the AST models barUnknown_propertyand the@font-facesrc, adding the SVG, anchor positioning, view transition and motion path families andCss.all(#1027, #1028, #1029, #1030, #1031).Cssbuilds the scroll-driven animation, border-image, multi-column, typography, vendor-prefixed and shape families, each with its value types (#1032, #1033, #1034, #1035, #1036, #1037, #1038, #1039, #1040).Css.Stylesheetfolds, iterates and edits every statement and declaration a sheet holds, andCss.mapandCss.sortreach rules inside every group at-rule (#317, #337, #355, #356, #363, #368, #381, #382, #384, #389).Css.Resolveanswers:nth-child(... of S),:nth-of-type(),:has(), the attribute case flags and:empty, and ranks a layer's own rules after its sublayers (#607, #873).Resolve.prepareandResolve.Make.resolve_preparedsplit the sheet-only work out ofresolve, so a caller walking a document pays it once (#394, #567).Css.Context.matches_mediahandles zero-valued boolean features and keeps unknown through negation, andmatches_containerrequires every queried feature (#868).Css.equal_statementandCss.hash_statementcompare and key a statement without printing it, andCss.Properties.compare_propertyis a total order (#513, #595).- New helpers include
Css.unknown_at_rule,Css.Declaration.value_of,Css.Values.gamut_map_color,Properties.read_filter_functionand the statement-merging passes (#591, #592, #600, #616, #626, #717, #872). Cascade_diff.Tree_diff.has_container_added_of_typeand itsremovedtwin look inside a whole container, andCascade.Error.to_stringprints valid UTF-8 (#395, #472).cascadedrops itsuutfdependency and the library does not linkunix.mtimereads the clock and ships a js_of_ocaml implementation (#609, #788).
CLI tools
cascade diff --browser --html PAGE.html A.css B.cssrenders both sheets over the page in headless Chromium, at each width and state either names, and compares the pixels (#1252, #1265, #1266, #1268).cascade diff --browserlists the computed styles under the pixels that differ, writes the report with--json, and exits 2 when it could not render (#1252, #1265, #1266, #1268).cascade prune PAGE.html... STYLE.cssremoves the rules a set of HTML documents cannot use, and--dry-runreports instead of writing (#605, #863).cascade fmt --import-root DIRkeeps--inline-importsreads under that directory (#744).cascade diffreads a side from standard input when it is-, writes JSON with--json, and bounds a report by whole differences with--limit(#792, #796, #799).- A
cascade diffreport counts each difference once, in the expected side's order. It shows what changed inside a block or a@keyframesframe (#345, #385, #389, #474, #580, #581, #783, #784, #794, #798, #814, #815, #906, #907). - A
cascade diffhunk escapes a byte with no glyph, a warning both inputs raise prints once, and a sheet where every rule changed runs near-linearly (#785, #786, #790, #791, #795). cascade applyreadsstyleattributes in source order, empties the<style>blocks it projects, keeps a page's comments and keeps a declaration whose longhand a kept rule also writes (#326, #329, #332, #339, #340, #346).cascade fmtexits 1 when parse recovery left no statement, andcascade applyexits 0 when a<style>block parses to at least one statement (#489, #494).- CLI help lists each option and exit status once and says what
--enforce-specgates, and--profilewithout--minifyprints no empty report (#611, #625, #628, #740).
Testing
- The render harnesses under
test/renderrequire a sheet and each transform of it to paint the same page, judged by the raster throughBrowser_compare.run(#1269). - A sweep renders every pair
--diff=canonicalcalls identical in headless Chrome and fails on any that paints differently.
1.1.0
Breaking
Css.hexraisesInvalid_argumenton a malformed hex string instead of returning opaque black, andCss.hex_optreturns an option (#232).cascade fmtandcascade diffdrop--memtrace, and the library drops thememtracedependency (#237).- A parse failure that drops every rule makes
cascade fmtexit 1 instead of writing an empty stylesheet (#273). cascade diff --diff=canonicalexits 1 and prints the difference whenever the canonical forms differ, andCss_compare.No_diffdoes not carry the two forms any more (#290).Tree_diff.tgainslayer_order, so record expressions must set it and record patterns must bind it or use; _(#295).- Optimizer profiling is per run.
Css.optimizeandOptimize.stylesheettake?stats:Stats.t, andOptimize.counters,pass_times,iteration_statsandset_profileare gone (#288). Resolve.NODEgainstext_children, the data of a node's direct text children, which:emptyneeds (#286).Apply.Make(...).computetakes~sheet:Stylesheet.tinstead of~css:string, so the caller parses, keeps the warnings and can tell invalid CSS from empty CSS.Apply.result.keptcounts every rule inside a block at-rule, where a@mediaholding three rules counted one (#287).cascade applyexits 1 and keeps the block when a<style>block or the supplementary stylesheet parses to nothing, where it deleted the block and exited 0 (#287).
Parsing
Reader.peek_utf8_atreturnsNonefor a negative or out-of-range offset instead of indexing outside the input (#308).- URL references use RFC 3986 resolution, keeping data, scheme-relative, query-only and fragment-only URLs (#304).
- Container conditions and media queries parse component values directly, so strings, escapes and general-enclosed values keep their CSS meaning (#305, #306).
- Typed
-webkit-and-moz-aliases use their standard value grammar. shape-outsidereads its whole grammar, somargin-box,url(shape.png)and every basic shape read where the declaration was dropped.- An identifier takes any code point at or above U+0080, so a class name holding one parses.
--enforce-specrestricts identifiers to the CSS Syntax 3 ranges (#254). perspective: none,text-underline-offset: autoand a negativetext-underline-offsetread where they were dropped with a warning (#212).- A nested rule whose selector starts with an identifier, such as
h2:where(...), reads, and an unrecognised media query such astheme(static)is kept as never-matching (#192, #193). - The
scroll-marginproperties take a negative length, as CSS Scroll Snap 1 allows (#280). - A
}ends a declaration value inParser.block_contentsinstead of swallowing the block, and a bad string prints back as one (#284).
Printing and nesting
background-positionandmask-positionprint one position per layer, comma-separated (#209).- A non-integer above roughly 4.6e10 prints as a number, where it printed as
scale(1.2345678.9012e+19)(#265). - An unknown at-rule keeps the space before its prelude under
--minify, where@foo bar {x:1}printed@foobar{x:1}(#272). - Flattening distributes the parent over every branch of a nested selector list:
.p { a, b { ... } }is.p a, .p b(#205). - Substituting
&wraps a complex parent in:is():.a .b { .dark & { ... } }flattens to.dark :is(.a .b)(#194).
Minification
--losslesspreserves logical sizing and corner aliases in source order.- A hex colour folds to its name whenever the name is not longer, so
#ffe4c4becomesbisque, andCss.Values.read_color_namereads all 148 names (#289). --losslesskeeps a longhand in source order against the shorthand that resets it, and a flow-relative property against a physical one of its family (#267, #270, #277).--losslesskeeps a colour's alpha exact, whereoklch(... / .74567)printed/.746(#278).- A vendor-prefixed value repeated with
!importantcollapses to the later declaration, sodisplay:-webkit-box;display:-webkit-box!importantkeeps one. - A selector list mixing a vendor pseudo-element with ordinary selectors is split, and a rule with nested children absorbs a later disjoint rule with its selector (#203).
- SVG presentation properties are typed and minify like any other value, so
paint-order: stroke fill markersbecomesstroke(#214, #228, #234, #235, #236, #240, #241, #242). - More values fold to an exact equivalent, among them
grid-auto-flow: row densetodense,hue-rotate(0rad),font-stretchkeywords and same-colour gradient stops (#206, #214, #229, #230, #257). --log=cascade.factor:debugreports the optimizer's factoring decisions (#239).--minifyis faster on a large stylesheet, for the same output (#221).
Custom properties and @layer
Css.inline_varsresolvesvar()across@layerboundaries, so a layered stylesheet inlines like its unlayered form (#187, #189).cascade applyprojects rules inside@layeronto elements, where a fully layered stylesheet such as Tailwind v4 output inlined nothing (#188).cascade applyweighs cascade layers: an unlayered declaration beats a layered one, and!importantreverses that (#283).cascade applykeeps a declaration in the stylesheet when a rule inside@scope,@starting-style,@when,@elseor@-moz-documentsets the same property (#286).cascade applyinlines only a rule whose selector its matcher can represent, and:emptycounts an element's text (#286).Css.vars_of_declarationsreports thevar()references of 39 more properties, soCss.resolve_themebindsinline-size: var(--w)as it doeswidth(#266).
Canonical diff
--diff=canonicalexpands selector-list rules, folds conditional blocks sharing a condition, reads@media not all and (X)as@media not (X)and keeps the last@propertyof a name (#204, #211, #227, #231).- Canonical mode skips the rule-regrouping passes, which depend on input order, and
Css.optimizetakes?regroupto turn them off (#215, #224). - Canonical mode normalises the space after a top-level comma in a custom property and drops a declaration a later rule with the same selector repeats (#206).
- A custom property keeps its
!important, layer and metadata, so two sheets that disagree about the flag differ (#271). - A quoted multi-word font name in a custom property equals its unquoted form, and under
--losslesscolor(srgb 1 0 0)equalsrgb(255 0 0)(#289, #290).
Diff report
- Grouping repeated selectors and conditions is linear in the number of rules and keeps source order (#307).
- The layer order the two sheets declare is compared, and the report names the layer pairs that swapped.
- Every entry names what it is about,
@property,@keyframes,@charset,@namespaceand@layer a, b;included. - A container that changed places is reported whether or not its body changed, where swapping an
@mediawith the rule below it read as identical. - A rule that writes one property more than once is compared occurrence by occurrence, and containers are compared however deep they nest (#285).
- A container entry with nothing under it reads as
(modified, no details), and a comparison that classified nothing says so instead of claiming there are no differences (#285). - A canonical-form difference the structural comparison missed prints as a string diff headed by the two file names (#290).
- A declaration reorder is reported inside
@media,@layerand@supports, and selector-less at-rules such as@pageare compared on their bodies (#268, #269). - An
@propertyentry names the descriptors that differ, a rule counts as reordered only when it moved against another rule, and the size summary follows the headers (#261, #263, #264). - A selector written by several rules is reported once, and an entry names the move when its declarations are spread differently (#259, #260).
- Blocks sharing a condition are paired one for one: three
@containerblocks against two report the removed block (#258). - Every statement of an added or removed container is reported, and a container no longer counts again as a rule (#253).
cascade diffbounds its report to the deepest level that fits, prints parse warnings above it, and reports blocks that only moved as a shift run (#210).
New properties and values
- The logical border properties are complete:
Css.border_block_colorand its siblings, theborder_inline_widthandborder_block_widthshorthands, and the start and end style longhands (#197, #198, #199, #200). Css.parse_font_family,Css.parse_list_style_typeandCss.parse_list_style_imageare new, the single-value readers behind thefontandlist-styleshorthands (#201, #202).Css.Values.oklch_none_hueis new, for an achromatic colour with a missing hue, printed asoklch(55.6% 0 none)(#190).
Testing
- CI rejects merlint findings and incomplete library record patterns (#310).
dune testrenders a stylesheet and its optimised forms in a headless browser and compares every element's computed style, skipping where no browser is installed (#275).
1.0.0
First public release. Cascade was extracted from the tw (Tailwind CSS v4 in OCaml) project as a standalone CSS command-line tool and library.
Library
- A typed CSS AST: selectors, declarations, values, statements and stylesheets are sealed ADTs, so an invalid construction is a compile error.
Css.of_stringruns CSS Syntax Level 3 recovery and returns the sheet with its warnings,~strict:trueturns the first warning into an error, andCss.of_string_exnraises.- A pretty-printer with pretty and minified modes (
Css.to_string ?minify), and typed printers such aspp_colorandpp_length. - Structural transforms (
fold,map,sort,flatten_nesting,inline_imports), and a structural CSS diff in thecascade.diffsub-library. - An optimizer that deduplicates, merges rules, combines selectors and folds shorthands, reaching the same output whatever the source order of cascade-safe rules.
- Minification optimises estimated gzip size by default.
~objective:`Raw(--objective=raw) optimises raw bytes for output that ships uncompressed. - Coverage of Selectors 4, Values and Units 4, Color 4 with 15 colour spaces, Conditional Rules 3 to 5, Cascade 5, Custom Properties 1, Fonts 4 and Animations 1.
- Over 400 typed properties, from the box model, flexbox and grid to anchor positioning, view transitions and the common vendor-prefixed properties.
- Custom-property support: typed
<syntax>parsing for@property, substitution against an explicitCss.Context.t, andvar()output that round-trips.
CLI tools
- CLI commands share one binary file reader that closes its descriptor when a read fails (#309).
cascadepretty-prints and minifies CSS files, reading standard input for-or no argument and writing to standard output.cascade --minifyapplies the safe transforms, among them deduplication, rule merging and nesting flattening, optimising estimated gzip size by default.cascade --inline-importsresolves local@importrules,cascade --inline-varssubstitutes static custom properties, and--keep-vars=NAMESkeeps some.cascade diffcompares two files inauto,tree,stringorcanonicalmode and exits 1 when they differ.canonicalreads equivalent factorings as identical.- The CLI installs as a binary from the Homebrew tap
samoht/tap/cascade, and through opam.
Notes
cascadeparses already-decoded UTF-8 strings. Byte-stream decoding (BOM,@charsetsniffing, HTTP charset) is the caller's job.- CSS nesting round-trips through the parser and printer, and the minifier flattens nested rules when safe.
@importrules are kept by default, and--inline-importsinlines them from the filesystem.- No source-map support.