ligershark / WebOptimizer

A bundler and minifier for ASP.NET Core
Apache License 2.0
756 stars 113 forks source link

AddWebOptimizer Overload with Minification and Pipeline #180

Open wcrowther-rentpath opened 3 years ago

wcrowther-rentpath commented 3 years ago

I am using WebOptimizer to add bundles and minify the CSS and JS files like below.

For Development, I want to turn off minification and am using the service.AddWebOptimizer overload below but it is still minifying the JS.

Is this the correct syntax?

bool minify =  false;   
IWebHostEnvironment environment =  // from StartUp injection
services.AddWebOptimizer 
(
    environment, 
    new CssBundlingSettings() { Minify = minify },
    new CodeBundlingSettings() { Minify = minify }, 
    pipeline =>
    {
        pipeline.AddJavaScriptBundle("/js/user_bundle.js", "js/common/enums.js", etc. ...
    }
)
dweggemans commented 2 years ago

I've tried various overloads and settings, but I am unable to disable minification with a custom pipeline. Your code seems to be correct at first sight but it does not work. Any suggestion on how to get this working properly?

EderWillian commented 2 years ago

I'm facing the contrary issue.

When calling AddJavaScriptBundle() or AddCssBundle() they stop minifiyng files