ASP.NET MVC 默认项目结构和脚本文件夹
将 Scripts 文件夹保留在默认的 ASP.NET MVC 项目结构中是否有任何优势?
在我看来,在 Content 文件夹下为脚本、CSS 文件和图像创建子文件夹更有意义。
这样做有什么缺点吗?
Is there any advantage to leaving the Scripts folder where it is in the default ASP.NET MVC Project structure.
In my mind it makes more sense to create subfolders for scripts, css files, and images under the Content folder.
Any downside to doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简而言之,不,这样做没有真正的缺点。这就是我构建 MVC 项目的方式。
实际上,这样做有一些优点......在许多项目中,我从单独的域提供所有静态内容,因此将所有静态内容分组到一个文件夹中使 QA/生产部署过程变得更加容易(因为我们正在使用 MSBuild 编写部署脚本并调用缩小 CSS 和 Javascript 文件的实用程序)。
In short, no, there is no real downside to doing this. It is how I have been structuring my MVC projects.
There are some advantages to doing this, actually... on many projects I am serving up all of the static content from a separate domain, so grouping all of the static content into a single folder has made the QA/production deployment process much easier (since we are scripting deployments with MSBuild and calling out to minify utilities for the CSS and Javascript files).
较小的缺点是必须在多个位置查找您可能拥有的每个附加框架等的“位”。因此,我更喜欢 \assets\ - 然后在每个框架文件夹(jquery、bootstrap 等)中我拥有所有 .JS 和 .该产品附带的 .CSS 等文件和/或子文件夹。然而,如果您愿意,MVC 捆绑允许您将所有引用放在一个 BundleConfig 模块/类中,从而有所帮助。
Minor downside is having to look in multiple places for the 'bits' of each add-on framework etc. you may have. Hence, I prefer \assets\ - then within each framework folder (jquery, bootstrap etc) I have all the .JS & .CSS etc files and/or subfolders that come with that product. However, MVC bundling helps by allowing you to have all your references in the one BundleConfig module/class if you wish.