Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To increase improve the load time of customer self service web pages you can use the application to minimise the style sheet (CSS) and JavaScript files at run time.

This uses Razor technology.

Step-by-step guide

To bundle and minify JavaScript files:

  1. Login as an administrator
  2. Go to the "Template Editor" page
  3. Open up the "Code Editor"
  4. Include web

...

  1. optimisation into the razor template
  2. Create a new "Script Bundle"
  3. Include your scripts into the bundle
  4. Create and load your bundle
Code Block
languagexml
@using System.Web.Optimization;
@{
  var cvScripts = new ScriptBundle("~/TemplateBundles/CVScripts");
}
... Other HTML here
@{
  cvScripts.Include("~/Scripts/cv.util.js");
}
... Other HTML here
@ {
  BundleTable.Bundles.Add(cvScripts);
	@Raw(@Model.TemplateUtil.ScriptRender("~/TemplateBundles/CVScripts"))
}

...

Tip

To enable this functionality the template needs to be a version 4 (Razor) template

 


Related

...

help

Content by Label
showLabelsfalse
max5
spacesKB
showSpaceDRAFTfalse
sortmodified
showSpacefalse
reversetrue
typepage
cqllabel in ("javascript","scripts-styles") and type = "page" and space = "KB"
labelskb-how-to-article javascript css

...