I have a pretty big CSS file, that I want to convert to less. When I wrote the CSS I did not know less.css, but now I still want to use my old CSS.
Is there a tool that can help me to convert it automatically?
I have a pretty big CSS file, that I want to convert to less. When I wrote the CSS I did not know less.css, but now I still want to use my old CSS. Is there a tool that can help me to convert it automatically? | |||||||||||
feedback
|
I actually found something now: http://leafo.net/lessphp/lessify/ It does a basic formating, e.g.:
to
| |||
feedback
|
Actually, you don't need any conversion tool to start working with LESS. LESS syntax is backwards compatible with CSS. It means any CSS file is also valid LESS file. Simply get your CSS and rename it to a LESS file. Then use LESS-specific features along with your changes. The more you'll update the file, the more you'll be able to use LESS features. I did the same for SCSS and a very big project with 10 CSS files. It was almost impossible (and a huge waste of time) to rewrite all CSS with SCSS. I simply renamed it, then every time I was working on the CSS file, I executed small refactoring on the code to take advantage of mixins, variables and so on. | |||
feedback
|
I don't think there is any way for a converter to know what you want to do with much of the code. For instance, it wouldn't necessarily know what variables you wanted to use. Or how to generate mixins or functions. I think with this one you will need to do it manually. | |||||||||||
feedback
|
How about search and replace. if you have just search I usually don't trust these tools. or you can write a really simple PHP script that handle it. Update 1: | |||||||||||
feedback
|
Have you looked at Least? It's much better at converting CSS than Lessify. In particular, Lessify doesn't optimize your classes very well. It copied the browser resets to all its generated mixins, creating redundant attributes. It's clear that it's still at the experimental stage. Neither utilities can determine semantics, so they can't convert values to expressions, vars, or parametric mixins. Least does a better job of optimization and seems to be more functional. It even handles pseudoclasses for you: These tools are ideal for working with large preexisting CSS files. Here are the steps I recommend to convert CSS to LESS (Make sure you keep a copy of the original CSS files):
I am not the author of Least, just someone looking for a similar tool and decided to tell the world about it. | |||||||
feedback
|
Try this site: css2less.cc It converts your CSS to LESS as you type. | ||||
feedback
|
The Minify CSS tools listed to the right give any users easy one click CSS compression. Just copy and paste your code into their online CSS compression tool form box, click submit, and seconds later you will have the same fully functioning CSS code... Just dramatically shrunk in bytes size.. 100% FREE - Compression and minification tools Click here to download http://www.minifycss.com/css-compressor/ | |||||||||
feedback
|
This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.