Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC inline bundle

I'm using ASP.NET MVC bundles to organise and optimise my scripts and CSS. The site I'm currently developing needs to perform well on mobile networks, so I'm trying to get all my html, JavaScript and CSS into a single request. Is there any way to get an MVC bundle to inline its contents in the requested html?

like image 694
Giles Roberts Avatar asked Jul 17 '13 12:07

Giles Roberts


1 Answers

Yes, there is. I've blogged about how to inline script and style bundles because I was facing the exact same problem. Here's the post:

  • Inlining CSS and JavaScript Bundles with ASP.NET MVC

The basic idea is to grab the BundleResponse that's created by the System.Web.Optimization framework and emit its contents within a <style> or <script> tag.

like image 87
Marius Schulz Avatar answered Nov 30 '22 23:11

Marius Schulz