Own jQuery version

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Own jQuery version

Ric-01
Dear all,

I'm using Tapestry 5.4.3 and the latest release version of
tapestry5-jquery in our application.

Can you give me a hint, how to force Tapestry to use another version of
jQuery and/or jQuery UI than the one bundled in libraries?

Thanks for your suggestions. I heard, that this should be possible, but
was not able to find this in the documentation.

Regrads, Ric

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Own jQuery version

Ben Weidig
Hi,

you can override the jquery version by contributing an override for
"jquery-library" in the JavaScriptStack.

We're using our own jQueryUI without tapestry-jquery by contributing
JavaScriptModuleConfigurations to the ModuleManager.

I've created a
https://gist.github.com/benweidig/90547102c7dc4dc233485fbfcd1ca5da for
better code readability but here's the code:

@Core
@Contribute(JavaScriptStack.class)
public static void overrideJquery(OrderedConfiguration<StackExtension>
conf) {
    conf.override("jquery-library",
StackExtension.library("classpath:META-INF/assets/jquery/jquery-3.3.1.min.js"));
}

@Contribute(ModuleManager.class)
public static void contributeModuleManager(MappedConfiguration<String,
JavaScriptModuleConfiguration> conf,
                                           @Inject
@Symbol(SymbolConstants.PRODUCTION_MODE) boolean productionMode,
                                           AssetSource assetSource) {

    final String path = "META-INF/assets/jquery-ui-1.10.3/min/";

    Resource coreResource = assetSource.getClasspathAsset(path +
"jquery.ui.core.min.js");
    JavaScriptModuleConfiguration core = new
JavaScriptModuleConfiguration(coreResources).dependsOn("jquery");
    conf.add("jquery.ui.core", core);

    Resource datepickerResource = assetSource.getClasspathAsset(path +
"jquery.ui.datepicker.min.js");
    JavaScriptModuleConfiguration datepicker = new
JavaScriptModuleConfiguration(datepickerResource).dependsOn("jquery.ui.core");
    conf.add("jquery.ui.datepicker", datepicker);

    ...
}

Hope this helps.

Ben

On Thu, May 10, 2018 at 10:34 AM Erich Gormann <[hidden email]> wrote:

> Dear all,
>
> I'm using Tapestry 5.4.3 and the latest release version of
> tapestry5-jquery in our application.
>
> Can you give me a hint, how to force Tapestry to use another version of
> jQuery and/or jQuery UI than the one bundled in libraries?
>
> Thanks for your suggestions. I heard, that this should be possible, but
> was not able to find this in the documentation.
>
> Regrads, Ric
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--

Ben Weidig
Netzgut GmbH
Reply | Threaded
Open this post in threaded view
|

Re: Own jQuery version

Ric-01
Hi Ben,

yes this helps. Thank you.

I askes because we had a PEN test finding related to an outdated jQuery
version, and so I have to update to a more recent one :-)

Regards, Ric


Am 10.05.2018 11:36, schrieb Ben Weidig:

> Hi,
>
> you can override the jquery version by contributing an override for
> "jquery-library" in the JavaScriptStack.
>
> We're using our own jQueryUI without tapestry-jquery by contributing
> JavaScriptModuleConfigurations to the ModuleManager.
>
> I've created a
> https://gist.github.com/benweidig/90547102c7dc4dc233485fbfcd1ca5da for
> better code readability but here's the code:
>
> @Core
> @Contribute(JavaScriptStack.class)
> public static void overrideJquery(OrderedConfiguration<StackExtension>
> conf) {
>      conf.override("jquery-library",
> StackExtension.library("classpath:META-INF/assets/jquery/jquery-3.3.1.min.js"));
> }
>
> @Contribute(ModuleManager.class)
> public static void contributeModuleManager(MappedConfiguration<String,
> JavaScriptModuleConfiguration>  conf,
>                                             @Inject
> @Symbol(SymbolConstants.PRODUCTION_MODE) boolean productionMode,
>                                             AssetSource assetSource) {
>
>      final String path = "META-INF/assets/jquery-ui-1.10.3/min/";
>
>      Resource coreResource = assetSource.getClasspathAsset(path +
> "jquery.ui.core.min.js");
>      JavaScriptModuleConfiguration core = new
> JavaScriptModuleConfiguration(coreResources).dependsOn("jquery");
>      conf.add("jquery.ui.core", core);
>
>      Resource datepickerResource = assetSource.getClasspathAsset(path +
> "jquery.ui.datepicker.min.js");
>      JavaScriptModuleConfiguration datepicker = new
> JavaScriptModuleConfiguration(datepickerResource).dependsOn("jquery.ui.core");
>      conf.add("jquery.ui.datepicker", datepicker);
>
>      ...
> }
>
> Hope this helps.
>
> Ben
>
> On Thu, May 10, 2018 at 10:34 AM Erich Gormann<[hidden email]>  wrote:
>
>> Dear all,
>>
>> I'm using Tapestry 5.4.3 and the latest release version of
>> tapestry5-jquery in our application.
>>
>> Can you give me a hint, how to force Tapestry to use another version of
>> jQuery and/or jQuery UI than the one bundled in libraries?
>>
>> Thanks for your suggestions. I heard, that this should be possible, but
>> was not able to find this in the documentation.
>>
>> Regrads, Ric
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]