Created
August 31, 2017 13:25
-
-
Save SigurdMW/1ee1e10356d71644ee562ede9ee23fcf to your computer and use it in GitHub Desktop.
Adding bundles in EpiServer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
@Styles.Render("~/Bundles/CSS") | |
... | |
@Scripts.Render("~/Bundles/JS") | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// App_Start/bundleConfig.cs | |
using System.Web.Optimization; | |
namespace Skuld.Web | |
{ | |
public class BundleConfig | |
{ | |
public static void RegisterBundles(BundleCollection bundles) | |
{ | |
//bundles.Clear(); | |
//bundles.ResetAll(); | |
bundles.Add(new StyleBundle("~/Bundles/CSS").Include( | |
"~/assets/dist/*.css") | |
); | |
bundles.Add(new ScriptBundle("~/Bundles/JS").Include( | |
"~/assets/dist/*.js") | |
); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
using System.Web.Optimization; | |
using EPiServer; | |
using Skuld.Web.Infrastructure.Mvc; | |
namespace Skuld.Web | |
{ | |
public class EPiServerApplication : Global | |
{ | |
protected void Application_Start() | |
{ | |
AreaRegistration.RegisterAllAreas(); | |
ViewEngines.Engines.Insert(0, new FeatureFoldersViewEngine()); | |
// Register JS and CSS bundles | |
BundleConfig.RegisterBundles(BundleTable.Bundles); | |
//Tip: Want to call the EPiServer API on startup? Add an initialization module instead (Add -> New Item.. -> EPiServer -> Initialization Module) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment