Minification failed. Returning unminified contents

前端 未结 12 2121
清酒与你
清酒与你 2020-12-24 11:24

I have made my first website using MVC 5 which works fine on my local machine but when I publish it to the server some of the CSS is not minifying correctly.



        
12条回答
  •  悲哀的现实
    2020-12-24 12:13

    For those that may stumble on this post... You can also resolve this by moving the @import to the first bundled item.

    According to: http://webdesign.about.com/cs/css/qt/tipcssatimport.htm

    @Import must always be first in the CSS document. When you bundle multipule CSS files together, it chains them into a single bundled css file. Since the second css file added to my bundle, in bundle config, contained an @Import at the start, as the files were chained together the @import appeared towards the middle of the newly merged document. Once I changed the bundle order the issue was resolved.

    This is important to understand because although you can use the minified files provided by plugins like bootstrap any changes made to the non-minified files during development will not be added to the existing minified css file. Meaning you will have to make the changes twice, and navigate your way through the minified file.

提交回复
热议问题