Skip to content

v5.1.0

Latest

Choose a tag to compare

@Shazwazza Shazwazza released this 02 Nov 18:18
92b2e12

Since 5.0.0 made NUglify the default minifier, any file NUglify can't parse fails the whole bundle request, and the error didn't tell you which file it was. This release makes that a lot friendlier and adds a simple way to turn minification off.

What's changed

  • NUglify errors no longer fail the bundle by default (#236). If NUglify reports errors for a file, Smidge now logs a warning and serves that file unminified. For example, a CSS declaration with an empty value like .b { width: ; } gives CSS1036 Expected expression, found ';'.
  • Errors now include the file path, error code, line and column, so you can actually find the problem in a composite bundle.
  • New NuglifySettings.ErrorBehavior - UseOriginal (the default) or Throw if you want the old fail-fast behavior.
  • New NuglifySettings.EnableMinification to turn JS and CSS minification off.
  • NuglifySettings now has a parameterless constructor and init properties, so it's much easier to configure:
services.AddSmidge(Configuration.GetSection("smidge"), new NuglifySettings
{
    EnableMinification = true,
    ErrorBehavior = NuglifyErrorBehavior.UseOriginal
});

Behavior change

If you were relying on bundle requests failing when NUglify couldn't parse a file, set ErrorBehavior = NuglifyErrorBehavior.Throw.

Also note that if a JS file falls back to unminified content while JS source maps are on, the bundle's source map can be inaccurate.

Full Changelog

v5.0.1...v5.1.0