-
Changelog. Add a new section to the top of
CHANGES.mdwith the output fromcomposer changelog.Edit your new section by following the Keep a changelog conventions, where by bullet points are under one of the "Added", "Changed", "Fixed", "Deprecated", or "Removed" labels.
Review each point and make sure it is phrased in a way that explains the impact on end-users of the library. If the change does not affect the public API or CSS output, remove the bullet point.
-
Version bump. Update
/lib/Less/Version.phpand setversionto the version that you're about to release. Also increasecache_versionto increment the last number. -
Commit. Stage and commit your changes with the message
Tag vX.Y.Z, and then push the commit for review. -
Tag. After the above release commit is merged, checkout the master branch and pull down the latest changes. Then create a
vX.Y.Ztag and push the tag.Remember to, after the commit is merged, first checkout the master branch and pull down the latest changes. This is to make sure you have the merged version and not the draft commit that you pushed for review.
This is an overview of the high-level steps during the transformation from Less to CSS, and how they compare between Less.js and Less.php.
Less.js:
less.render(input, { paths: … })Parser.parsenormalizes inputParser.parseparses input into rules viaparsers.primaryParser.parsecreates the "root" ruleset objectParser.parseapplies ImportVisitorImportVisitorapplies these steps to eachImportnode:ImportVisitor#processImportNodeImport#evalForImport
ImportVisitorends withImporVisitor#tryRunloop (async, after last call toImportVisitor#onImported.
less.rendercallbackParseTree.prototype.toCSStransformTreeapplies pre-visitors, compiles all rules, and applies post-visitors.
ParseTree.prototype.toCSSruns toCSS transform on the "root" ruleset.
- CSS result ready!
Less.php
Less_Parser->parseFileLess_Parser->_parseLess_Parser->GetRulesnormalizes input (viaLess_Parser->SetInput)Less_Parser->GetRulesparses input into rules viaLess_Parser->parsePrimary
Less_Parser->getCssLess_Parser->getCsscreates the "root" ruleset objectLess_Parser->getCssapplies Less_ImportVisitorLess_ImportVisitorapplies these steps to eachImportnode:ImportVisitor->processImportNodeLess_Tree_Import->compileForImport
ImportVisitorends withImporVisitor#tryRunloop (all sync, no async needed).
Less_Parser->getCssapplies pre-visitors, compiles all rules, and applies post-visitors.Less_Parser->getCssruns toCSS transform on the "root" ruleset.
- CSS result ready!
The wikimedia/less.php package inherits a long history of loosely compatible
and interchangable Less compilers written in PHP.
Starting with less.php v3.2.1 (released in 2023), the public API is more clearly
documented, and internal code is now consistently marked @private.
The public API includes the Less_Parser class and several of its public methods.
For legacy reasons, some of its internal methods remain public. Maintainers must
take care to search the following downstream applications when changing or
removing public methods. If a method has one or more references in the below
codebases, treat it as a breaking change and document a migration path in the
commit message (and later in CHANGES.md), even if the method was undocumented
or feels like it is for internal use only.