Can I use Stylus and/or Jade with Spring 4 MVC project?

喜欢而已 提交于 2019-12-08 04:13:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!