Gravatar for dipsindol@gmail.com

Question by DEEPTHI KATTA, Oct 25, 2016 1:58 PM

Force Coveo not to load jQuery and Other dependencies

Quick question - On Coveo JavaScript framework I found this - https://developers.coveo.com/display/public/JsSearch/Dependencies

It talks about how I can remove Coveo from loading it's own jQuery version

It does not expound on how I can do that. Any clue?

1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Oct 25, 2016 2:15 PM

Hi,

In order to load your own version of the Coveo JavaScript Search Framework dependencies, you have to avoid using the CoveoJsSearch.Dependencies*.js and CoveoJsSearch.WithDependencies*.js files in your pages.

Instead, you have you reference each dependency in its own script tag and then reference the CoveoJsSearch[.min].js file after. You can then decide to avoid using the Coveo JavaScript Search Framework jQuery version and reference your own version instead.

Be sure to test thoroughly as your jQuery version might be incompatible with the Coveo JavaScript Search Framework.

If you are using Coveo for Sitecore, the Coveo JavaScript Search Framework and its dependencies are normally included in the page from the Coveo Search Resources component which uses the CoveoJsSearch.WithDependencies.min.js file or the Coveo Search Box Resources component which uses the CoveoJsSearch.Dependencies.min.js and CoveoJsSearch_Searchbox.min.js files. You would have to duplicate this sublayout/view and modify your copy to load the dependencies as explained above.

I hope this helps!

Jeff

Gravatar for dipsindol@gmail.com

Comment by DEEPTHI KATTA, Oct 25, 2016 4:04 PM

Thank you so much. Makes much more sense.

Since, the CoveoJsSearch.WithDependencies.js is concatenated, it is super hard to see what the actual dependancies are - Is the listed safe to assume if the list of all dependencies Coveo has?

<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/underscore-1.4.4.min.js"></script>
<script src="js/globalize.min.js"></script>
<script src="js/l10n.js"></script>
<script src="js/jstz.min.js"></script>
<script src="js/ModalBox.js"></script>
<script src="js/CoveoJsSearch.min.js"></script>

I will obviously swap the jquery given here with the project specific version.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Oct 25, 2016 5:52 PM

I think there is also one named magic-box and one named fast-click. It may depend on your version of the Coveo JavaScript Search Framework (v0.9 or v1) and the build number.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Oct 26, 2016 11:34 AM

Can I ask you 2 questions:

  • Why do you want to remove the Coveo JavaScript Search Framework jQuery dependency? Is is to avoid conflicts with your own version or to improve the page load performance?
  • Which release of Coveo for Sitecore are you using?

With newer releasers of the Coveo JavaScript Search Framework, all the dependencies will be embedded in the CoveoJsSearch[.min].js file and the external dependencies file will be empty. All the dependencies will be local to the framework and won't cause any conflicts anymore. With such release, it will be impossible to replace a JS UI dependency with your own to improve page load performance.

Ask a question