views:

187

answers:

2

Is there any tool which can automatically convert shorthand css to longhand? I need this cause I want to use SmartSprites which does not work well with shorthand.

And prefably also a tool which does the reverse, so after the sprite computation i can minify the css as much as possible...

Also any other solutions for automatic spiriting is welcome, basically im looking for some command line tools which can be integrated into the build process so that the developers still develop on the raw css code.

A: 

For the reverse, you can use a CSS optimiser like csstidy. I doubt it will convert shorthands to non-shorthands though.

Why not forbid the use of shorthands by developers and use csstidy in the build process?

If you don't like that idea, you could write a small script to do the shorthand conversion, which is significantly easier than the other way around. It basically comes down to string replacement.

fhd
From what ive tried... csstidy doesn't convert shorthand to the long version. The css comes from the clients existing site and will be completely re-written in the future(without shorthand)... for now I have to make do with the existing css... which is full of shorthand css. Far too many to elongate by hand.Since I am only interested in elongating the background property, I'll try to write something in python.
sajal
Yeah, I didn't think csstidy would do it that way around either. Good luck with the script!
fhd
+1  A: 

You can use Dragonfly on Opera. Dragonfly is like Firebug on Firefox and Chrome but developed by Opera. There is a function in Dragonfly which let you alter the shorthand and vica versa. Check dev.opera.com/articles/view/introduction-to-opera-dragonfly/

Wollen Muts
Thanks a lot. you saved me a lot of work...
sajal
@sajal: You're welcome, glad I could help.
Wollen Muts