【发布时间】:2018-11-09 13:28:24
【问题描述】:
我有一个捆绑文件的项目,例如:
bundles.Add(new StyleBundle("~/css/master/supplierbundle").Include(
"~/Content/components/bootstrap/dist/css/bootstrap.min.css",
"~/Content/components/jquery-ui/themes/smoothness/jquery-ui.css",
"~/css/mystyles.css"));
BundleTable.EnableOptimizations = true;
这些文件是捆绑在一起的,所以在我的页面源中我有:
<link href="/css/master/supplierbundle" rel="stylesheet"/>
但样式没有呈现 - 只是页面显示没有任何样式
它不能在调试或发布模式下工作。
编辑
在头部插入包:
@Styles.Render("~/css/master/supplierbundle")
【问题讨论】:
-
当您导航到
/css/master/supplierbundle时会得到什么? javascript 控制台中是否有任何错误? -
@Joseph
<html><body><h1>Page not found</h1><h3>No umbraco document matches the url '/css/master/supplierbundle'.</h3><p>This page can be replaced with a custom 404. Check the documentation for "custom 404".</p><p style="border-top: 1px solid #ccc; padding-top: 10px"><small>This page is intentionally left ugly ;-)</small></p></body></html> -
这就是你的答案; href中的url一定是错误的。
-
请分享如何将此链接标签添加到您的_layout/master 页面的代码。我错过了 cachebusting 查询字符串,例如 /content/master/supplierbundle?v=K8bEDKv6DE_2BHLRTdisqFsdq1BnRrJx3CvCQ_HR7eo1
-
没有错,是bundle链接@pfx
标签: css bundle bundling-and-minification