AspNetWebOptimization icon indicating copy to clipboard operation
AspNetWebOptimization copied to clipboard

Support CSS variables

Open gelambert opened this issue 7 years ago • 3 comments

Hello,

Do you plan to support CSS variables ? Currently, minification fails because of it.

Thanks for your answer.

gelambert avatar Aug 01 '18 10:08 gelambert

This is particularly important if you're using Bootstrap 4, since that now uses CSS variables.

Example error message:

Minification failed. Returning unminified contents.
(6,10): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'

RichardD2 avatar Aug 17 '18 13:08 RichardD2

Hey @RichardD2,

I'm using Bootstrap 4 too, so I'm in the same boat ! Did you find any alternative (other library) ? For my part, I think I will give a try to Bundler & Minifier

Thanks for your answer !

gelambert avatar Aug 31 '18 14:08 gelambert

@gelambert: I ended up using a modified version of Max Vasilyev's BetterStyleBundle, but based on Bundle instead of StyleBundle to exclude the CssMinify transform. Since Bootstrap has pre-minified files, I just added those to the bundle directly.

bundles.Add(new BetterStyleBundle("~/css/core").Include(
    "~/js/lib/bootstrap/css/bootstrap.min.css",
    "~/js/lib/fontawesome/font-awesome.min.css",
    "~/css/site.min.css"));

My BetterStyleBundle code.

RichardD2 avatar Aug 31 '18 14:08 RichardD2