Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS to SASS (or LESS) conversion [closed]

Tags:

css

sass

less

Can anyone recommend some CSS to less, or CSS to sass conversion tools? I have found a few .e.g. http://css2less.cc/ and http://css2sass.herokuapp.com/ but any insight into their reliability (or recommendations of other tools) would be greatly appreciated. I have a large CSS code base for a white label solution which would benefit greatly from having a CSS preprocessor in place but it would be a huge task to manually convert to sass/less.

Thanks in advance

EDIT: I should emphasize I'm particularly interested in experiences of using a tool (such as those listed above (in the absence of any better ones)) to convert a large CSS code base towards using a CSS preprocessor such as SASS or LESS. Or if any other ways (other than the tools listed) to achieve such a feat are pragmatic. What hurdles did you have to overcome? Is it even worth attempting? Or are such metalanguages only suited to a new project where you can start from scratch?

like image 545
rbginge Avatar asked Nov 19 '12 08:11

rbginge


People also ask

How do I convert LESS to SASS?

You can convert LESS to SCSS manually by converting @'s to $'s and writing your LESS mixins in SCSS format, and fix any SCSS errors as you go (compile as you go to get the errors).

Can we convert CSS to SCSS?

Click on the URL button, Enter URL and Submit. This tool supports loading the CSS File to transform to SCSS. Click on the Upload button and select File. CSS to SCSS Online works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari.

Why are developers using LESS and SASS instead of CSS?

SASS allows you to use a nested syntax, which is code contained within another piece of code that performs a wider function. In SASS, nesting allows a cleaner way of targeting elements. In other words, you can nest your HTML elements by using CSS selectors.

Is LESS compatible with SASS?

Sass and Less are both very powerful CSS extensions. You can think of them as more of a programming language designed to make CSS more maintainable, themeable, and extendable. Both Sass and Less are backward compatible so you can easily convert your existing CSS files just by renaming the . css file extension to .


1 Answers

I made good experiences with http://css2sass.heroku.com/. You can also find their code base on github. You can also convert files directly via the sass-convert tool which will be installed by the original sass gem. Basically this is just what css2sass is doing.

Just call:

sass-convert -F css -T sass original_file.css converted_file.sass 
like image 169
bjunix Avatar answered Oct 06 '22 00:10

bjunix