1
ASP.NET MVC에서 필자의 발걸음을 옮기고 번들 링에 걸림돌이났습니다. 여기 번들 된 스크립트가 제대로 렌더링되지 않습니다.
내 BundleConfig.csbundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/bower_components/jquery/dist/jquery.js"
));
bundles.Add(new ScriptBundle("~/bundles/jquery-ui").Include(
"~/bower_components/jquery-ui/ui/core.js",
"~/bower_components/jquery-ui/ui/widget.js",
"~/bower_components/jquery-ui/ui/position.js",
"~/bower_components/jquery-ui/ui/menu.js",
"~/bower_components/jquery-ui/ui/autocomplete.js"
));
bundles.Add(new ScriptBundle("~/bundles/mondernizr").Include(
"~/Scripts/modernizr-*"
));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/bower_components/bootstrap/dist/css/bootstrap.css",
"~/Content/PagesList.css",
"~/Content/Site.css",
"~/bower_components/font-awesome/css/font-awesome.css"
));
의 내용이며, 여기에 내가 머리에 스크립트와 CSS를 렌더링 할 위치 영역 내 _Layout HTML입니다.
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/jquery", "~/bundles/jquery-ui")
@Scripts.Render("~/bundles/modernizr")
는 지금까지 내가 알고 있어요로 난 그냥 출력 스크립트/링크 태그의 전체 목록 또는 번들 버전 중 하나를 그것을 얻기 위해 번들에 지정된 것과 동일한 상대 경로를 사용해야합니다. 대신에 나는 기대했던 끝에 버전 문자열을 넣지 않고 다음을 얻는다.
<link href="/Content/css" rel="stylesheet"/>
<script src="/bundles/jquery"></script>
<script src="/bundles/jquery-ui"></script>
<script src="/bundles/modernizr"></script>
BundleTable.EnableOptimizations를 true 또는 false로 설정하면이 문제가 발생합니다.