Copied to clipboard

Flag this post as spam?

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


  • Per Bolmstedt 72 posts 326 karma points
    Mar 08, 2022 @ 10:13
    Per Bolmstedt
    0

    Backoffice/admin CSS Smidge/NUglify error, breaking package styling

    When Umbraco admin/backoffice loads, it loads this CSS:

    /sb/umbraco-backoffice-css.css.v637823303400000000

    However, this URL returns a 500 because of the following error:

    System.InvalidOperationException: Expected expression, found '',Expected expression, found '' at Smidge.Nuglify.NuglifyCss.ProcessAsync(...) ... at Smidge.FileProcessors.CssImportProcessor.ProcessAsync

    In the development environment Smidge/NUglify doesn't seem to run, so we get one CSS for each package, and of all these work.

    So it seems the backoffice/admin Smidge/NUglify is broken because something in the installation, or a package, makes Smidge/NUglify try to import an empty file, or something similar.

    Clearing the App_Plugins folder and re-installing and re-deploying all packages does not help.

    As a workaround, is there a way to turn off backoffice/admin Smidge/NUglify to get the same behavior as in development? Removing the RuntimeMinification block from AppSettings doesn't seem to make a difference.

    Any other ideas what could be breaking this?

    The packages that load CSS files are:

    • Diplo GodMode
    • Translation Manager
    • Translation Manager Languagewire Connector
    • Umbraco Forms
    • uSync

    Removing each package one by one and testing is a bit tedious because it works in development. And when clearing the App_Plugins folder in production Umbraco still tries to load CSS/JS from those folders, so Smidge/NUglify breaks anyway. Not sure how Umbraco "remembers" what to load.

  • Kevin Jump 2145 posts 13579 karma points MVP 6x c-trib
    Mar 08, 2022 @ 10:31
    Kevin Jump
    0

    Hi,

    when in production there is a 'version' number setting (which isn't there by default) that can be used to break the cache for minification.

    i think by default its related to the umbraco version - but you can se the value to any number and it will regenerate the cached files .

    from the docs :

    "Umbraco": {
      "CMS": {
        "RuntimeMinification": {
          "UseInMemoryCache": false,
          "CacheBuster": "Version",
          "Version": "1234"
        }
      }
    }
    

    In terms of the issue you having, i would take a look on development (which is probably running in debug mode?) and see if there are any files that are not loading in the browser (e.g 404 errors in the network tab in chrome) - if there are files missing then in debug Umbraco will still attempt to load them but silently fail.

  • Per Bolmstedt 72 posts 326 karma points
    Mar 08, 2022 @ 10:48
    Per Bolmstedt
    0

    Thank you.

    It's the minification itself that causes the 500 in production, not the cache; clearing all Smidge caches recreates the problem and the NUglify error. Is there any way to actually disable backoffice/admin minification in production?

    There are no 404s or other indications in development/debug that anything is missing. Umbraco itself and all packages load fine and have all CSS applied. Specifically, all CSS files configured in all package manifests (as far as we can see) exist on disk and are loaded in development/debug.

  • Kevin Jump 2145 posts 13579 karma points MVP 6x c-trib
    Mar 08, 2022 @ 11:00
    Kevin Jump
    0

    Hi Per,

    I don't think there is a way of disabling minification short of moving the whole site into debug :(

    I've just done a quick test on v9 with those packages and the CSS file does appear to still work when in production. it might be worth checking you are running the latest versions of the packages/umbraco ??

    from my quick test :

    <ItemGroup>
        <PackageReference Include="Diplo.GodMode" Version="9.2.1" />
        <PackageReference Include="Jumoo.TranslationManager" Version="9.0.6" />
        <PackageReference Include="Jumoo.TranslationManager.LanguageWire" Version="9.1.0" />
        <PackageReference Include="Umbraco.Cms" Version="9.3.0" />
        <PackageReference Include="Umbraco.Forms" Version="9.3.0" />
        <PackageReference Include="uSync" Version="9.2.0" />
    </ItemGroup>
    
  • Per Bolmstedt 72 posts 326 karma points
    Mar 08, 2022 @ 13:28
    Per Bolmstedt
    0

    Thank you.

    Could this be related to .NET 5 vs .NET 6? I know that we had problems with System.WebOptimizer that when upgrading to .NET 6 paths with wildcards stopped working, e.g. /assets/css/*.css. The solution is running on .NET 6.

    EDIT: This works on a different Umbraco .NET 6 installation, so likely not.

  • Arild Lindeflaten 2 posts 73 karma points
    Mar 17, 2022 @ 08:26
    Arild Lindeflaten
    1

    Hi Per,

    Did you find a solution for this? I'm having the exact same problem.

  • Per Bolmstedt 72 posts 326 karma points
    Jul 04, 2022 @ 19:55
    Per Bolmstedt
    0

    No. Did you? We've upgraded to 9.5.2 but the problem remains.

    Since it seems to work in a minimal reproduction our only plan at the moment is to recreate the web project and migrate all the code/settings. And we would probably do this when upgrading to Umbraco 10.

    If NuglifyCss could report which manifest or css file causes the error it would help. :)

Please Sign in or register to post replies

Write your reply to:

Draft