Built-in ASP.NET MVC Package

I use ASP.NET MVC packages to organize and optimize my scripts and CSS. The site I'm currently developing should work well on mobile networks, so I'm trying to get all my html, JavaScript and CSS in one request. Is there a way to get the MVC package to embed its contents in the requested html?

+4
source share
2 answers

Yes there is. I wrote about how to embed script packages and style, because I ran into the same problem. Here is the message:

The main idea is to capture the BundleResponse created by the System.Web.Optimization framework and emit its contents in the <style> or <script> .

+3
source

I do not think it's a good idea.

From yslow best practices

http://developer.yahoo.com/performance/rules.html#external

Using external files in the real world usually creates faster pages because the JavaScript and CSS files are cached by the browser. JavaScript and CSS, which are embedded in HTML documents, are loaded every time an HTML document is requested. This reduces the number of HTTP requests that are needed, but increases the size of the HTML document. On the other hand, if JavaScript and CSS are in external files cached by the browser, the size of the HTML document is reduced without increasing the number of HTTP requests.

0
source

Source: https://habr.com/ru/post/1491878/


All Articles