0

I am looking into the bundling features of ASP.NET 4.0 and am just curious what rules/practices people follow when deciding which files to bundle?

Should I group things by what they are, like put all jQuery files together or is it a good idea just to bundle up all files that are used in the same place?

4

2 回答 2

2

我建议阅读有关捆绑和缩小的本教程

捆绑和缩小

就个人而言,我喜欢每页有一个 css 包和一个 js 包。每个捆绑包将仅包含该页面所需的文件。保持 http 请求和大小。

于 2014-02-27T15:42:25.147 回答
0

我认为如何捆绑你的文件在很大程度上是主观的。我认为大多数人都会同意的唯一一件事是,一旦你拥有的文件不止几个,你就应该组织你的文件。

如果您在一个简单的网站上工作,并且只有几个 JS 文件和一个 CSS 文件,我认为将它们放在同一个地方没有问题。

一旦你得到多个文件,我喜欢至少按类型对它们进行分组:

/lib/css
/lib/js
于 2014-02-27T15:56:38.203 回答