Poe*_*HaH 6 asp.net-mvc bundling-and-minification asp.net-bundling
如何从另一个文件夹(除了Script文件夹)使用JavaScript捆绑工作.如果我这样做:
bundles.Add(new ScriptBundle("~/bundles/search").Include("~/Views/Search/*.js"));
Run Code Online (Sandbox Code Playgroud)
浏览器告诉我无法找到javascript文件.是否可以这样做或者我的所有sripts都必须在Scripts文件夹中?
基本上我希望我的Javascript包含在我的View子文件夹中
小智 3
您需要根据以下答案更改文件夹:
web.configIn ASP.NET MVC, how can I load script from my view folder?Views
Ashley Lee 就是一个很好的例子:
<system.webServer>
<handlers>
<add name="JavascriptViewHandler" path="*.js" verb="*"
preCondition="integratedMode" type="System.Web.StaticFileHandler" />
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*"
preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
975 次 |
| 最近记录: |