• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
技术无止境
勇敢、创新、坚韧、执着——青年应具备的精神
博客园    首页    新随笔    联系   管理    订阅  订阅
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;

 

posted on 2018-02-01 00:56  刘宁  阅读(223)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3