Using Alchemy’s Built In Libraries

One of the features of Alchemy that I think will end up being the most helpful in the future is the way it lets you build a plugin and never have to worry about whether it’ll stop working with future versions of Tridion. This is because Alchemy provides helpful wrappers for the Anguilla framework used to interact with the CMS. If Tridion ever moves on from Anguilla (as has long been rumoured) Alchemy will update the wrappers to support the new technology and if your plugin is using these wrappers you shouldn’t even have to think about it.

I bring this up because I wanted to show how to use another Alchemy feature that provides similar future-proofing: the built in JS libraries available for your plugins, such as JQuery, ZeroClipboard and more. Not only are these libraries invaluable in building your plugins, but by using the built in Alchemy version you never need to worry about updating your plugin with newer versions. We’ll take care of that as part of our constant updates to Alchemy.

How do you use these libraries? It’s simple. First you need to add them to your resource group:

Screen Shot 2015-09-26 at 19.16.20


Next you add a reference in any JS file in which you want to use the library:

Screen Shot 2015-09-26 at 19.32.56


Note that I used ‘$j’ for jquery. This is because the more common ‘$’ is already used in the global namespace for Tridion by Sizzle.js.

That’s it! You now have a version of a library that you never need to update and will stay modern.

The nice thing about having to assign the variable yourself is that it means you can use multiple versions of a library if needed. Maybe you are using a deprecated method in a library and haven’t found an acceptable substitute in later versions. You can use your own, old version of this library for the specific functionality you need, while using the built-in and automatically updating version of the library where you can. This gives you the maximum flexibility to build your plugin using the specific library and version you need, when you need them, while not having to worry about updating your plugin every time your libraries do.

Want to use this functionality but don’t see the library you need included in Alchemy? Submit a ticket to our GitHub project and we’ll investigate adding it to future versions.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>