Last Updated: February 25, 2016
·
365
· thecodeking

Using Cassette bundles with Sitecore

Injecting client-side references into a layout from a renderer in Sitecore is complex due to the fact that Sitecore does not support MVC sections.

Additionally Sitecore does not provide a way to optimise client-side references in the context of a modular Sitecore design. In an ideal scenario renderings would register their dependent scripts and styles for include in the master layout, and have them deduped at runtime.

One solution to these challenges is the Nuget Cassette.Aspnet package. Cassette allows Stylesheet and JavaScript bundles to be injected into a Sitecore layout from a nested renderer. As well as automatically deduping and ordering references, Cassette also minifies JavaScript files and can compile SASS.