Last active
April 9, 2017 22:06
-
-
Save cpoDesign/3a0b8bf54c99d339db651bf3030bc8c8 to your computer and use it in GitHub Desktop.
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
public class SiteStartupHandler : IApplicationEventHandler | |
{ | |
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication,ApplicationContext applicationContext) | |
{ | |
// Register bunding for umbraco | |
RegisterStyles(BundleTable.Bundles); | |
RegisterJavascript(BundleTable.Bundles); | |
} | |
private static void RegisterStyles(BundleCollection bundles) | |
{ | |
//Add all style files. These will be bundled and minified. | |
//After everything has been bundled (which only happens when debug=false in the web.config) check if there are no errors in the bundled file. Not all files can be bundled. | |
bundles.Add(new StyleBundle("~/bundle/site.css").Include( | |
"~/content/style.css" | |
) | |
); | |
} | |
private static void RegisterJavascript(BundleCollection bundles) | |
{ | |
//Add all javascript files. These will be bundled and minified. | |
//After everything has been bundled (which only happens when debug=false in the web.config) check if there are no errors in the bundled file. Not all files can be bundled. | |
bundles.Add(new ScriptBundle("~/bundle/site.js").Include( | |
"~/scripts/example.js" | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment