Re: Own jQuery version

Ben Weidig <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <CAMa1C33sCJx4=1tQ4JaAanRz--3Jpr4c7KD_Wq4Zb7aefTZqEg@mail.gmail.com>
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 <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>

-- 

Ben Weidig
Netzgut GmbH
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.