tags:

views:

818

answers:

4

I'm looking for SASS implementation in Java (could be used with JSP/JSF). For Python I've found CleverCSS, but there is nothing for Java. Anyone heard something about this sort of tool for generating CSS?

+3  A: 

I personally find SASS syntax deeply, horribly annoying. For Ruby / Python crowd it may come as second nature; for me as Java guy - not so much. I strongly prefer LESS which builds upon CSS syntax instead of coming up with a new one. That has a nice added advantage of being able to use your existing CSS files "as is" and incorporate LESS features as needed.

That said, neither SASS nor LESS have java ports as far as I know. Both are ruby-based, however, so you can install them under JRuby. The only issue with that approach is JRuby is mind-numbingly slow to start up. It's not a huge deal, though, because you're likely going to use file monitoring in development (and once it does startup it runs very smooth) and you're not going to care as much that your build takes few seconds longer during deployment.

There are also some PHP-based implementations like LessPhp, xCSS and others. Haven't tried them personally, though.

ChssPly76
jomohke
+3  A: 

Given that SASS has to be converted to CSS to be usable, what is wrong with using sass2css that distributes with Ruby SASS?

aussiegeek
+3  A: 

There is one project: http://code.google.com/p/jsass/ (but it's in a very early stage).

If you are interested in Less, there is a ready-to-use Java version for it: http://www.asual.com/lesscss/

golimpio
A: 

You can also take a look to Web Resource Optimizer 4 J which allows a lots a things (minification, resource merging) and supports Less CSS (at runtime as far as I know).

This means: you add wro4j filter to your web.xml and when you ask for a CSS, your .scss (or .saas) files are compiled to standard CSS.

I have not used it yet, but it seems more advanced than other products listed here.


In fact, I was reading comments on the Less for Java website (http://www.asual.com/lesscss/) and WRO4J uses this library to provide it's "on the fly Less compilation". So I think Less for Java is the way to go.

legzo