BundleTable.EnableOptimizations true breaks jquery-ui all.css

后端 未结 1 1695
别那么骄傲
别那么骄傲 2021-01-20 01:18

In an Asp.Net MVC 5 application, I am creating a style bundle in my egisterBundles method.
I\'m using jquery-ui.
Instead of listing all

相关标签:
1条回答
  • 2021-01-20 01:25

    According to this answer the default minifier simply does not support the @import directive:

    MVC4 bundling CSS failed Unexpected token, found '@import'

    Also, the jquery-ui css files contain relative paths to images, so the virtual path of the bundle must allow the browser to find the relative path to the images, for example:

    bundles.Add(new StyleBundle("~/Content/themes/base/jqueryui")
       .Include("~/Content/themes/base/core.css" [and other desired css files]));
    

    And on the cshtml page:

    @Styles.Render("~/Content/themes/base/jqueryui")
    

    See this link for explication: MVC4 StyleBundle not resolving images

    0 讨论(0)
提交回复
热议问题