mvc使用bundle發佈時css丟失的解決方法

環境爲vs2013須要將 工具-庫程序包管理-nuget管理,更新 microsoft asp.net web optimization1.1.3,系統默認好像是1.0.0,若是不更新,不能繼承IItemTransform,會提示命名空間不存在,更新便可。
更改bundleconfig.cs

public class CssRewriteUrlTransformWrapper : IItemTransform
    {
        public string Process(string includedVirtualPath, string input)
        {
            return new CssRewriteUrlTransform().Process("~" + VirtualPathUtility.ToAbsolute(includedVirtualPath), input);
        }
}
bundles.Add(new StyleBundle("~/Content/css").Include(
                         "~/Content/bootstrap/css/bootstrap.css"
                         ).Include("~/Content/plugins/magnific-popup/magnific-popup.css"
                         ).Include("~/Content/plugins/owl-carousel/owl.carousel.css"
                         ).Include("~/Content/css/style.css"
                         ).Include("~/Content/css/custom.css"
                         ).Include("~/Content/css/skins/red.css"
                        ).Include("~/Content/css/animations.css", new CssRewriteUrlTransformWrapper()));
BundleTable.EnableOptimizations = false;
相關文章
相關標籤/搜索