tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thiago H de Paula Figueiredo" <thiag...@gmail.com>
Subject Re: Tapestry 5.4 - changing built-in js-module versions, using extrnal sources
Date Thu, 07 Nov 2013 14:16:45 GMT
On Thu, 07 Nov 2013 12:01:29 -0200, Michael Wyraz  
<michael.wyraz@evermind.de> wrote:

> Hi,

Hi!

> today I started working with the new require.js approach and modules
> within T5.4. I have some question which I could not anwser using google
> and the list archives.
>
> 1. How would one replace an internal library with a more recent version.
> Example: embedded jQuery (which is 1.9 shall be replaces with 1.10).
>
> I did the following which works - but I'm not sure if that is the right  
> way:
>
>          @Contribute(ModuleManager.class)
>          public static void setupBaseModules(MappedConfiguration<String,
>     Object> configuration,
>     @Path("${tapestry.asset.root}/jquery-1.10/jquery.js")
>                                              Resource jQuery)
>          {
>              configuration.override("jquery-library", new
>     JavaScriptModuleConfiguration(jQuery));
>          }

Looks very good to me.

> 2. How could I retrieve such "module" assets (especially loaded via
> require.js) from an external source like a CDN?
> This is at least possible with require.js:
> https://github.com/requirejs/example-jquery-cdn
> But how can I do it with a tapestry module?

It's done already and it should have been included in alpha 24. Check the  
new ModuleConfigurationCallback interface and  
JavaScriptSupport.addModuleConfigurationCallback() method. Basically, you  
can implement a callback that will receive a JSONObject containing the  
RequireJS configuration, so you can change it in any way you need, then  
return it.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message