Versions Compared

Key

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

...

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 optimisation into the razor template
  5. Create a new "Script Bundle"
  6. Include your scripts into the bundle
  7. 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"))
}

To bundle and minify CSS files:

  1. Login as an administrator
  2. Go to the "Template Editor" page
  3. Open up the "Code Editor"
  4. Include web optimisation and Bundler into the razor template
  5. Create a new "cv Style Bundle"
  6. Include your styles into the bundle
  7. Create and load your bundle

 

Code Block
languagexml
@using System.Web.Optimization;
@using Bundler;
@{
  var cvStyles = new cvStyleBundle("~/TemplateBundles/CVStyles");
}
... Other HTML here
@{
	cvStyles.Include("~/documents/css/print/pmain.css");
	cvStyles.Include("~/documents/css/print/pbutton.css");
	cvStyles.Include("~/documents/css/print/preset.css");
// or you can use
	cvStyles.Include( new string [] {
		"~/documents/css/handheld/hbuttons.css",
		"~/documents/css/handheld/hreset.css",
		"~/documents/css/handheld/hmain.css"
	});
}
... Other HTML here
@{
  BundleTable.Bundles.Add(cvStyles);
  @Raw(@Model.TemplateUtil.StyleRender("~/TemplateBundles/CVStyles"))
}

 

 

 

 

Tip

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

 

Content by Label
showLabelsfalse
max5
spacesDRAFT
sortmodified
showSpacefalse
reversetrue
typepage
labelskb-how-to-article javascript css

...