+1 but we need an API to create the webjar URLs.
Thanks,
Marius
On Wed, Jul 31, 2013 at 5:18 PM, Vincent Massol <vincent(a)massol.net> wrote:
Hi devs,
I'd like to make it easy in XWiki to use javascript frameworks required by
extensions.
I've found the webjars project (
http://webjars.org) which packages javascript
frameworks in JAR files available in Maven Central.
They work out of the box if you drop them in WEB-INF/lib in a Servlet 3.0 container (like
Jetty 7). It works because the 3.0 spec says that any files located in
META-INF/resources/<path> will be made available by the servlet container as static
resources (accessible as <path>).
However the servlet 3.0 specs doesn't support adding those JAR dynamically outside of
WEB-INF/lib so it doesn't work with our extension mechanism.
Thus I'm proposing the following (which I have tested to work):
* Add a new WebJarFilter filter to web.xml
* The URL to access, for ex, angular.js packaged in the
http://repo2.maven.org/maven2/org/webjars/angularjs/1.1.5-1/angularjs-1.1.5… jar
would be: /xwiki/webjar/angularjs/1.1.5/angular.js
This allows for example to have a dep on:
<dependency>
<groupId>org.webjars</groupId>
<artifactId>angularjs</artifactId>
<version>1.1.5-1</version>
<scope>runtime</scope>
</dependency>
Then in a JSX object:
require(["/xwiki/webjar/angularjs/1.1.5/angular.js"], function() {
…
});
WDYT?
Thanks
-Vincent
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs