where I've rewritten the webjars integration using a new Action module.
I've also added an API to create the URL. Here's a usage example:
require(["$services.webjars.url('angularjs/1.2.11/angular.js')"],
function() {
...
See also
Thanks
-Vincent
On 1 Aug 2013 at 09:01:10, Vincent Massol (vincent@massol.net(mailto:vincent@massol.net))
wrote:
On Aug 1, 2013, at 8:53 AM, Marius Dumitru Florea wrote:
+1 but we need an API to create the webjar URLs.
Yes, I had thought of this too. It would be nice to not have to add the
"/xwiki/webjar" prefix but more importantly it'll work even if you change
the servlet context.
Thanks
-Vincent
>
> Thanks,
> Marius
>
> On Wed, Jul 31, 2013 at 5:18 PM, Vincent Massol 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/ will be made available by the servlet container as static resources
(accessible as ).
>>
>> 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:
>>
>>
>> org.webjars
>> angularjs
>> 1.1.5-1
>> runtime
>>
>>
>> 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