Different add-ons with same vendor code
Permalink
Say I have two block types on one page.
Both block types register a javascript asset by the same handle.
The loaded javascript code is also exactly the same, but each block has it packaged within itself.
Will there be conflicts when the page loads since it's going to load the same script twice? Or by setting the asset handle to be the same in each package will c5 only load one of them?
Both block types register a javascript asset by the same handle.
The loaded javascript code is also exactly the same, but each block has it packaged within itself.
Will there be conflicts when the page loads since it's going to load the same script twice? Or by setting the asset handle to be the same in each package will c5 only load one of them?
Does c5 know the code is the same because of the handle used to register the asset regardless of which package registered it?
Assuming so, that would mean if two packages register the same assets but with a different handle then c5 will load both assets?
Assuming so, that would mean if two packages register the same assets but with a different handle then c5 will load both assets?
I tested this and it uses the latest version of that handle / asset.
- Changed the asset version in one of the blocks, only latest version loads
Different handle different asset.
- Changed the asset name in one of the blocks, js loads twice only different locations
- Changed the asset version in one of the blocks, only latest version loads
Different handle different asset.
- Changed the asset name in one of the blocks, js loads twice only different locations
So I guess the only issue that could occur is if two different package authors register the same asset but use different asset handles for the asset.
Here is an old howto from way back when there was no asset protection and some scripts like fancybox were regularly breaking sites as yet another developer bundled their own copy, often pasting it into a view.js, so obscuring obvious clues. The trick can still be useful secondary protection.
https://legacy-documentation.concrete5.org/tutorials/protect-a-jquer...
https://legacy-documentation.concrete5.org/tutorials/protect-a-jquer...
It uses the one from the last block that needs it.
Example:
Image Slider
Pagelist Slider
It loads the one from pagelist slider