Shazwazza / Smidge

A lightweight runtime CSS/JavaScript file minification, combination, compression & management library for ASP.Net Core
MIT License
365 stars 47 forks source link

Bundler does not support nested CSS #209

Open portfolioris opened 3 months ago

portfolioris commented 3 months ago

I assume Smidge is responsible for bundling CSS when adding a CSS file to a package.

If I use this css:

.some-class {
    & .some-sub-class {
        color: lime;
    }
}

The bundled output to /sb/umbraco-backoffice-css.css.v638545637345803210 returns a 500 error.

My guess is it doesn't support the relatively new syntax.

CZEMacLeod commented 3 months ago

Looking at the readme of the project - the default minifier is (a port) of jsmin. The code can be seen here. You can configure it to use NUglify but according to this issue it does not support nesting either (which as far as I can tell is still in draft?). I'm not sure if there is much difference between the nesting syntax and less syntax - but you could try adding a pre-processor into the pipeline and passing your CSS files through dotless or similar, to expand them to standard flat css. Alternatively, you could use a pre-processor on the css files at design time to flatten them.