Is there a library / addon for Spring / SpringMVC in the form of stars?

I tried to do this using the build tools, but in the end I want something like Sprockets . Does this exist for Spring / SpringMVC projects? Or do I need to write a servlet for this and cache the result?

Basically, in order to avoid the need to maintain information on javascript development dependencies in html and production dependency information on my maven pom.xml , I think it would be better to put dependencies in the comments of the actual javascript and css files, This is what Sprockets does.

Such a solution is better than using an assembly system, because your development and production environments are no longer needed - everything is defined in one place. You literally no longer need to deal with pom.xml , and you no longer need to edit javascript / css tags in your html template.

The problem with building web applications with Java at the moment is that if you want to minimize and aggregate your assets, you end up doing it in Maven or Gradle, which means if you want to test your "live" JavaScript code, which is uncompressed and not aggregated, you must support separate script tags in the html layout template. This is a poor design for maintainability. If you do not want to use live development versions, you are forced to re-compress and re-aggregate your javascripts / css using maven after EVERY manual editing. This is not a good way to develop applications, so Sprockets is so attractive - it solves this problem by completely giving it away from the build system.

I don't need all the fancy features Sprockets have. For example, I don’t need all the support for engines like CoffeeScript and SASS. Basic Javascript / css support is fine. I'm more interested in the compression / aggregation / dependency management functions, as well as the timestamp / caching functions, so that the server does not perform compression / aggregation for each page request.

+4
source share
1 answer

Is Jawr the thing you are looking for?

+2
source

Source: https://habr.com/ru/post/1384900/


All Articles