Re:CSS to Less
by chrisacky on Thursday May 03, 2012 @09:45AM
(#3923803)
It kind of works. I didn't really expect it to work for my mamotth 9000 line CSS. Would be perfect for small projects though definitely.
I write in LESS to start with. So I took the compiled CSS from less, then tried to run it through the css2less convertor, then recompile what it generates.
[4] Comments get mangled (confirmed from another commentor below)
[5] Generates duplicate properties (where the duplicates didn't exist in precompiled). Creating duplication properties is actually correct, such is the case where you would want duplicate background properties (to support IE/FF/Chrome gracefully etc). However, you don't want it to generate identical properties where the values are also the same.
[6] font-faces wrong. (To be fair, this is hard to get right even in normal LESS).
All constructive feedback. I'm still impressed that it did a fairly decent job.
I write in LESS to start with. So I took the compiled CSS from less, then tried to run it through the css2less convertor, then recompile what it generates.
Few things I noticed.
[1] Selectors get rearranged
[2] Cannot correctly handle base64 images
[3] Cannot handle child selectors. ie :child / n-th child.
[4] Comments get mangled (confirmed from another commentor below)
[5] Generates duplicate properties (where the duplicates didn't exist in precompiled). Creating duplication properties is actually correct, such is the case where you would want duplicate background properties (to support IE/FF/Chrome gracefully etc). However, you don't want it to generate identical properties where the values are also the same.
[6] font-faces wrong. (To be fair, this is hard to get right even in normal LESS).
All constructive feedback. I'm still impressed that it did a fairly decent job.