See example below.
Now, in your Application_Start() method within the Global.asax file, you call your bundling provider. A good idea is to enable optimizations only when building in release mode. When optimizations are enabled, the bundle will automatically combine each ScriptBundle and StyleBundle into one request, as well as minify each result.
The last step is to modify your _layout.cshtml file to reference the bundles. In the BundleConfig file that we created, we created a name for each of the ScriptBundle and StyleBundles. You reference these in your layout using the following format.
That’s it! You have now optimized your website, limiting the amount of requests done per page per user while allowing separation of your style sheets and scripts during development.
We hope you have found this week’s edition of “To The Point” by Kevin Doig to be helpful and informative. Look out for our next week instalment as we continue to explore unique topics from business to the latest technology.
We want to hear your point! If you have any ideas, suggestions or any questions about our weekly blog, please contact us at: email@example.com.
Point Alliance Team