Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kole Pottorff 3 posts 73 karma points
    Oct 06, 2023 @ 18:33
    Kole Pottorff
    0

    Integrating WebMarkupMin into Umbraco 12?

    I've been trying to integrate WebMarkMin into Umbraco 12 to minimize HTML output, but it hasn't been working. I'm using WebMarkupMin.AspNetCore7 version 2.14.1

    with this code in ConfigureService::

          services.AddWebMarkupMin(
              options =>
              {
                  options.AllowMinificationInDevelopmentEnvironment = true;
                  options.AllowCompressionInDevelopmentEnvironment = true;
    
              })
          .AddHtmlMinification(
              options =>
              {
                  options.MinificationSettings.RemoveRedundantAttributes = true;
                  options.MinificationSettings.RemoveHttpProtocolFromAttributes = true;
                  options.MinificationSettings.RemoveHtmlComments = true;
                  options.MinificationSettings.RemoveHtmlCommentsFromScriptsAndStyles = true;
              })
          .AddXmlMinification()
          .AddHttpCompression();
    

    and in Configure:

        app.UseWebMarkupMin();
    

    any ideas?

  • Kole Pottorff 3 posts 73 karma points
    Oct 10, 2023 @ 20:23
    Kole Pottorff
    0

    I still haven't found a solution to this

  • Robin Hansen 135 posts 368 karma points
    Dec 04, 2023 @ 15:33
    Robin Hansen
    1

    Hi Kole, I successfully managed to minify my source code. The trick is to run the UseWebMarkupMin BEFORE UseUmbraco in the service. E.g.:

            app.UseHttpsRedirection();
    
            app.UseWebMarkupMin(); <---
    
            app.UseUmbraco()
                .WithMiddleware(u =>
                {
                    u.UseBackOffice();
                    u.UseWebsite();
                })
                .WithEndpoints(u =>
                {
                    u.UseInstallerEndpoints();
                    u.UseBackOfficeEndpoints();
                    u.UseWebsiteEndpoints();
                });
    
            app.UseSmidge(bundles =>
    
  • Kole Pottorff 3 posts 73 karma points
    Dec 04, 2023 @ 17:47
    Kole Pottorff
    0

    Thanks Robin! I'll try it out

Please Sign in or register to post replies

Write your reply to:

Draft