Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep bundle, but disable minify not working #317

Open
marius-kazlauskas-trimble opened this issue Jul 28, 2024 · 1 comment
Open

Keep bundle, but disable minify not working #317

marius-kazlauskas-trimble opened this issue Jul 28, 2024 · 1 comment

Comments

@marius-kazlauskas-trimble
Copy link

marius-kazlauskas-trimble commented Jul 28, 2024

I am using Blazor (Server Side Rendering). I want to keep bundles, but disable minify. I have tried 3 different methods with no success:

  1. Result: Bundle: Yes, but Minify is still ON
builder.Services.AddWebOptimizer(
    builder.Environment,
    new CssBundlingSettings { Minify = false },
    new CodeBundlingSettings { Minify = false },
    option =>
    {
        option.EnableCaching = true;
        option.EnableDiskCache = false;
        option.EnableMemoryCache = true;
        option.AllowEmptyBundle = true;
    },
    pipeline =>
    {
        pipeline.AddCssBundle("css/bundle.css", "css/a.css", "css/b.css");
        pipeline.AddJavaScriptBundle(
            "js/bundle.js",
            "javascript/a.js",
            "javascript/b.js"
        );
    }
);
  1. Result: Bundle: No, Minify: No
builder.Services.AddWebOptimizer(minifyJavaScript: false, minifyCss: false);

builder.Services.AddWebOptimizer(
    pipeline =>
    {
        pipeline.AddCssBundle("css/bundle.css", "css/a.css", "css/b.css");
        pipeline.AddJavaScriptBundle(
            "js/bundle.js",
            "javascript/a.js",
            "javascript/b.js"
        );
    },
    option =>
    {
        option.EnableCaching = true;
        option.EnableDiskCache = false;
        option.EnableMemoryCache = true;
        option.AllowEmptyBundle = true;
    }
);
  1. Result: Bundle: Yes, Minify: Yes
builder.Services.AddWebOptimizer(
    pipeline =>
    {
        pipeline.AddCssBundle("css/bundle.css", "css/a.css", "css/b.css");
        pipeline.AddJavaScriptBundle(
            "js/bundle.js",
            "javascript/a.js",
            "javascript/b.js"
        );
    },
    option =>
    {
        option.EnableCaching = true;
        option.EnableDiskCache = false;
        option.EnableMemoryCache = true;
        option.AllowEmptyBundle = true;
    }
);

builder.Services.AddWebOptimizer(minifyJavaScript: false, minifyCss: false);

Maybe there is some other way how keep bundle, but disable minify? I need this, because I need to keep bundles in my dev env.

@Mos455
Copy link

Mos455 commented Oct 20, 2024

I tried this, and it worked for me:

builder.Services.AddWebOptimizer(
    pipeline =>
    {
        pipeline.AddCssBundle(
            "/css/bundle.css",
            "css/site.css",
            "lib/bootstrap/css/bootstrap.min.css",
            "lib/smartwizard/css/smart_wizard.min.css");

        pipeline.AddJavaScriptBundle(
            "/js/bundle.js",
                new JsSettings()
                {
                    CodeSettings = {
                        MinifyCode = false
                    }
                },
            "lib/jquery/jquery.js",
            "lib/bootstrap/js/bootstrap.bundle.js");
    },
    option =>
    {
        option.EnableCaching = true;
        option.EnableDiskCache = false;
        option.EnableMemoryCache = false;
        option.AllowEmptyBundle = false;
    }
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants