简体   繁体   English

ASP.NET MVC捆绑子文件夹结构

[英]ASP.NET MVC Bundling Subfolders structure

I want to include javascript files from whole folder and subfolders into a single ASP.NET Bundle. 我想将整个文件夹和子文件夹中的javascript文件包含到单个ASP.NET捆绑包中。 The purpose of this is to load all files from that folder at once. 这样做的目的是一次从该文件夹加载所有文件。

The idea is to create an angular application and load all app files with a single bundle. 这个想法是创建一个角度应用程序,并通过一个捆绑包加载所有应用程序文件。

  1. Is this idea ok ? 这个主意好吗?
  2. The problem I have is that the Script tags added to HTML don't respect the subfolder strucutre of my application and the files can't be found. 我遇到的问题是,添加到HTML的Script标记不遵守我的应用程序的子文件夹strucutre,并且找不到文件。

Bundle config: 捆绑配置:

 bundles.Add(new ScriptBundle("~/bundles/app").IncludeDirectory(
            "~/app", "*.js", true));

Folder Structure 资料夹结构

app
 controller/appMenu.js
 modules/navigation.js
 app.js

On client side the included tags look like this: 在客户端,包含的标签如下所示:

<script src="/app/appMenu.js"></script>
<script src="/app/navigation.js"></script>

I think it might be related to this: http://aspnetoptimization.codeplex.com/workitem/105 我认为这可能与此有关: http : //aspnetoptimization.codeplex.com/workitem/105

What version of the System.Web.Optimizations assembly are you using? 您正在使用哪个版本的System.Web.Optimizations程序集?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM