Views: 5080
Number of votes: 5
Average rating:

Uncompressed JavaScript for EPiServer 7.6+

TL;DR
To run your site with uncompressed JavaScript in edit mode, install the EPiServer.CMS.UI.Sources package from nuget.episerver.com on your web project. Add <clientResources debug="true" /> to your web.config inside the episerver.framework element.

 

JavaScript Debug Files Explained

A while back I posted a blog about using uncompressed JavaScript files for debugging EPiServer 7. I thought it would be worth highlighting how you can use uncompressed JavaScript in EPiServer 7.6 and onwards and how it works with the new continuous release cycle. I am happy to say it is even easier than before!

As of EPiServer 7.6 the CMS UI has been released via NuGet packages. These packages contain all the JavaScript files required to run the UI compressed into a zip file. The system then reads the contents of the zip file at run time. The great thing about this approach is that at initialization, if the client resources debug flag is set to true, the system will first look for a debug version of the JavaScript zip file and load that instead if it exists.

Introducing the EPiServer.CMS.UI.Sources NuGet package. The only thing this package contains is the debug version of the JavaScript zip file. Having this as a NuGet package means that if you update the UI to the next version then the debug files will automatically be updated as well. The JavaScript source package is built as part of every release so it ties quite simply into the continuous release cycle. You can install it the same way you would any other NuGet package from nuget.episerver.com.

Install-Package EPiServer.CMS.UI.Sources

In order to have the system use the debug files you need to enable debug mode for client resources. You can do this simply by adding the <clientResources debug="true" /> element to your web.config inside the episerver.framework element. You can then toggle the debug files on and off by changing the value of the debug attribute from true to false.

    (By Henrik Fransas , 15 August 2014 20:14, Permanent link)

    Nice, This is a great help when trying to built more advanced properties or debugging when something is wrong.

    Great work!

    (By paul.klingl , 26 August 2014 05:45, Permanent link)

    Hi Ben, great article. In my case, I need to make and keep the changes to some of these files. What do you recommend as the best way to re-compress with my changes?

  Please login to post a comment