LESS to Stylus Converter
CV-48Rewrite LESS as Stylus: @variables become Stylus variables, mixins become functions-style mixins, braces and semicolons go, and review notes list what could not convert.
Runs in your browser. Nothing is uploaded.
LESS code
Stylus code
How to use it
- Paste your LESS into the input box, or open a .less file.
- Leave review notes on to get a comment block listing unsupported items.
- Choose the indent and press Convert to Stylus.
- Copy the Stylus or download it as a .styl file.
How the conversion runs
The LESS is parsed and its LESS-only syntax is rewritten first, then the tree is written as Stylus. @gap: 8px becomes $gap = 8px. ".rounded(@r: 4px) {}" becomes "rounded($r = 4px)", and ".rounded(6px);" becomes "rounded(6px)". &:extend(.a all) becomes @extend .a. Indentation replaces braces and semicolons.
Not converted
Guards, detached rulesets, @plugin, @arguments, merge properties and JavaScript are left out or commented, and each appears in the notes with its line number. Stylus and LESS differ on operators and some functions, so read the arithmetic and color functions in the result.
Testing the output
The Stylus produced here is not run through the Stylus compiler on this page. Put it through your build and compare the CSS with what the LESS used to give you. Compile the LESS with the LESS to CSS tool first if you want a reference to compare against.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Missing } to close the block opened on line 3. | A rule or at-rule was opened with { and never closed. | Add the missing } at the end of the block that starts on the named line. |
Unexpected } on line 5: there is no block to close. | There is a } with no matching {. | Delete the extra } or add the { it belongs to. |
Unterminated /* comment starting on line 2. | A /* comment has no closing */. | Close the comment with */. |
Unexpected { with no selector before it, on line 4. | A { appears with nothing before it to name the rule. | Add a selector before the { or remove it. |
Questions people ask
How do I convert LESS to Stylus?
Paste the LESS and press Convert to Stylus. The tool rewrites the LESS-specific syntax and writes the result with indentation and no braces. Save it as a .styl file and compile it with Stylus.
How are LESS variables written in Stylus?
As $name = value. A LESS line "@brand: #0a6;" becomes "$brand = #0a6", and uses of @brand become $brand. Uses of the variable are renamed the same way throughout the file.
Are LESS mixins supported?
Yes: a definition like ".box(@w; @h: 2px)" becomes "box($w, $h = 2px)" and a call becomes "box(1px)". Guards on mixins are not translated and are listed in the notes.
Is the Stylus output compiler-checked here?
No, the Stylus compiler is not part of this page. The structure is produced by this tool's own converter, so test the result in your project before you rely on it.
Will the compiled CSS match my LESS?
For simple variables, nesting and mixins it should. Operators, color functions and anything in the review notes can differ between LESS and Stylus, so compare both outputs.
About this tool
Rewrites LESS into Stylus syntax from its own parser, in two steps: LESS to an SCSS-shaped tree, then that tree to Stylus. Variables become $name = value, mixins become name(args) definitions and calls, and braces and semicolons are removed. Guards, detached rulesets, @plugin and JavaScript are not converted and show in the review notes. The output is not run through the Stylus compiler on this page, so test it before you rely on it. Stylus and LESS differ on operators and some functions, so read the result.