Here's one that worked, producing a module called jquery-ui: public static void contributeModuleManager(MappedConfiguration<String, Object> configuration, @Path("/META-INF/assets/js/jquery-ui-1.9.1.js") Resource jqueryUi) { configuration.add("jquery-ui", new JavaScriptModuleConfiguration(jqueryUi)); }
HTH, Geoff On 18 Jun 2014, at 10:25 am, Sanket Sharma <sanketsha...@gmail.com> wrote: > Hi, > > How do I convert a non AMD javascript module to work with require.js? > > I did some investigate and it seems like shimming is the way to go. > I would like to take a javascript file ol.js and shim to to export 'ol'. > The file is located under modules and is packaged in META-INF/modules > directory in the standard tapestry way. > > Reading source code and documentation seems to suggest it can be done in > the following way: > > @Contribute(ModuleManager.class) > public static void setupOpenLayersConfiguration( > MappedConfiguration<String, Object> mappedConfiguration, > @Inject @Path("classpath:META-INF/modules/ol/ol.js") Resource ol) { > JavaScriptModuleConfiguration openLayers = new > JavaScriptModuleConfiguration(ol); > openLayers.exports("ol"); > mappedConfiguration > .add("ol", openLayers); > } > > What is the correct syntax to refer to inject this file as a resource? The > above class path syntax seems to be failing. > > Is there a pure Javascript way as well? Been trying to play with > config/shim blocks but couldn't get it working. > > Any help would be appreciated. > > Best Regards, > Sanket