On 12 Aug 2015 at 22:31:11, vinc...@massol.net 
(vinc...@massol.net(mailto:vinc...@massol.net)) wrote:

> Hi Bryn,
>  
> On 12 Aug 2015 at 22:05:25, Bryn Jeffries 
> (bryn.jeffr...@sydney.edu.au(mailto:bryn.jeffr...@sydney.edu.au)) wrote:
>  
> > Vincent suggested:
> > > > Try depending on jquery-ui maybe?
> > >
> > > Right, I'd misunderstood the purpose of require(), which I thought was to
> > > provide compatibility vs prototype when using '$'.
> > >
> > > However, this still doesn't fix things completely, but does move them
> > > forwards a bit.
> > > require(['jquery','jquery-ui'], function($) {
> > > $( "#spinner" ).spinner();
> > > });
> > >
> >
> > Actually, more playing around eventually gave me this, which does work:
> > require(['jquery',"$services.webjars.url('jquery-ui', 'jquery-ui.js')"], 
> > function($) {
> > $( "#spinner" ).spinner();
> > });
> >
> > I wouldn't say I'm 100% sure of what I'm doing with require, or if this is 
> > the best way to do it, but at least it works without errors.
>  
> That looks correct. The reason you could simply use “jquery” in the require() 
> function is because it’s declared in javascript.vm:
>  
> require.config({
> paths: {
> 'jquery': '#removeJsSuffix($services.webjars.url("jquery", 
> "jquery${jsExtension}"))',
> 'bootstrap': '#removeJsSuffix($services.webjars.url("bootstrap", 
> "js/bootstrap${jsExtension}"))',
> 'xwiki-meta': '$stringtool.removeEnd($xwiki.getSkinFile('js/xwiki/meta.js'), 
> '.js')',
> 'xwiki-events-bridge': 
> "$stringtool.removeEnd($xwiki.getSkinFile('js/xwiki/eventsBridge.js'), '.js')"
> },
> …
>  
> This is not the case for jquery-ui or for other webjars. This is why you need 
> to use $services.webjars.url(..).
>  
> Would be great if you could help us and add this information on 
> http://platform.xwiki.org/xwiki/bin/view/DevGuide/FrontendResources :)
>  
> If you don’t have the time, I’ll do it when I’m back from holidays (still on 
> holidays for the coming 4 days :)).

errr…. 11 days… :)

-Vincent

> Thanks
> -Vincent
>  
> > Thanks,
> >
> > Bryn
>  

_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to