less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17.03k stars 3.41k forks source link

beautify less code #2202

Closed chiefjester closed 6 years ago

chiefjester commented 10 years ago

Is there a an equivalent cli tool for less css? The reason I asked is currently we are using sass-convert to beautify our sass, we're moving to less for future projects.

Also beautifying code is just one thing, but it also normalized our code which is good for collaboration. The developers don't need to agree to whatever style since it will be reformatted upon by save. We are using sassbeautify plugin which uses sass-convert for beautifying options.

So as soon as you save sass it reformats it on the fly. So git diffs are easy to see on the commits as well.

lukeapage commented 10 years ago

no, sorry we don't have a beautifier built in, though other beautifiers do support less.

Its been requested a few times and wouldn't now be too difficult to implement, but I'm too busy at the moment.

chiefjester commented 10 years ago

May I at least know what beautifiers support less? I was actually looking for a sublime plugin and stumbled upon css format sublime plugin. The problem with these formatters is that they don't fully support less.

This issue for instances, where it breaks on string interpolation from sass can also be applied if you're using less.

https://github.com/mutian/Sublime-CSS-Format/issues/12

The problem with these formatters is it just use 'normal' css formats. And once do more complex function in less, (which is the whole point of using OOCss), it normally breaks.

seven-phases-max commented 10 years ago

May I at least know what beautifiers support less?

Sorry we are not monitoring that stuff to know this too (Well, I think I won't be mistaken to guess that there're none. Yes, some CSS formatters are enabled to work with Less too (e.g. csscomb) but none of them has real Less parser so they will break even with not-so-complex Less syntax).

chiefjester commented 10 years ago

Hi @seven-phases-max , That question was just response to what @lukeapage just mentioned

other beautifiers do support less.

So its just a simple follow up question of what are those beautifiers mentioned here.

einthusan commented 9 years ago

Yes, this is a real big problem for us as well.. desperately looking for a cli to do this.

seven-phases-max commented 9 years ago

Probably this should be merged to #1271 (since to "beautify" Less using less.js itself, in first place there're should be a way to output Less... And if it's not about using less.js than this is simply out of this repo scope).

matthew-dean commented 9 years ago

Why not just use an IDE that supports code coloring for Less? I'm sure _(cough) someone **(cough)**_ makes one.

oliverjanik commented 8 years ago

The whole point of doing formatting tool by less project is so that IDE's can use that standard formatting and not recreate their own incompatible versions.

I wanted to write an extension for VsCode to autoformat less and well this is the first place I looked.

The less compiler understands AST of less, therefore this is the best place to create a nicely formatted output of that AST.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.