开发者

Does something like Sprocket exist for Java

Sprocket is a Ruby library for managing JavaScript dependencies. It makes it possible to declare dependencies in specially formatted comments in the JavaScript files, and have all the required files concatenated server side. (Read more here: http://getsprockets.org/)

Where I work, we have a real need for such a framework, but it has to be in the form of a Java library.

Does such a thing exist? What other solution开发者_运维问答s have you come up with to manage JavaScript dependencies?


You may have a look at this webutilities as well.


You can also use juicer to merge javascript files although it's also written in ruby.
Another option that, I suppose, will suit you is using combiner by Nicholas C. Zakas if you do not need all the features of juicer and sprockets. It is pretty simple, written in java (.jar) and the source can be found in author's repository. You can also fork the source in order to tune it according to your needs.


Such a feature exists in the Wicket framework. It is a component-oriented web framework for Java that is gaining momentum these days.

Wicket lets you define header resources in your components (eg, Javascript scripts, CSS files, etc.) and combines them at runtime, removing duplicates.


I know this was answered a long time ago but my vote is for JAWR!


You can run sprockets inside a java web application using jruby. It is not too difficult. You could disable sprockets in production and only use statically compiled assets if you are worried about performance. It's also possible with Servlet-3.0 to completely disable sprockets in production and have the same web.xml or you could do dodgy things with a proxy context listener and proxy servlet filter if you are concerned about having to load the jruby runtime and sprockets even when you are not using it.

I have an example here: https://github.com/benmmurphy/java_sprockets


Yes, it does exist and its even richer in functionality https://github.com/QubitProducts/miniMerge.

Ii is also very fast and very small (few kb)! All you need is java.

I use it in my all projects, it is not only for JS, I use it also with CSS and HTML.

One awesome thing is that you can specify file or directory as input and filter contents based on tagging!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜