问题
I have gotten used to/fell in love with Stylus for preprocessing css and Jade for simplifying my HTML in the Node.JS world. Now I am back to working on a Spring 4 MVC project and would like to use those technologies in this environment.
Is it possible to integrate them (I am using Gradle)? A quick google search for Stylus Java Gradle returned no helpful responses.
Thanks!
回答1:
Stylus and Jade seem to be popular in the JavaScript world, not so much in the JVM world.
Here are the closest tools I know about, with good support in the JVM world:
- LESS, for a CSS preprocessor replacement
- Groovy Templates are quite close to Jade
- Spring Framework 4.1 will also include some improvements for handling static resources (see SPR-10933 and SPR-11800)
回答2:
For Jade, you can use Jade4J (https://github.com/neuland/jade4j). There is a Spring-ready version too.
回答3:
The approach we took was to use Webpack to transpile everything (Pug, Stylus, Less, Coffee, etc) then using the generate-source
goal in Maven (might be slightly different for Gradle) we include an exec for webpack.
来源:https://stackoverflow.com/questions/24511846/can-i-use-stylus-and-or-jade-with-spring-4-mvc-project