Copied to clipboard

Flag this post as spam?

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


  • Adriano Fabri 459 posts 1602 karma points
    Oct 14, 2022 @ 16:06
    Adriano Fabri
    1

    Umbraco v10 - my custom backend css only works in my local website but not in production website

    Hi,

    I'm trying to do some tests to extend my Umbraco 10.2.1 website. In this case I would to override the original backoffice style with some customizations (below there is an example).

    I create my custom folder into App_Plugins and I create the package.manifest and the customized backoffice style.css.

    package.manifest

    {
        "name": "custom_umbraco_backoffice_style",
        "version": "1.0.0.0",
        "css": [
            "~/App_Plugins/custom_umbraco_backoffice_style/style.css"
        ]
    }
    

    style.css

    .umb-rte {
        max-width: 100% !important;
        background-color: #00ffff !importnat;
        padding: 10px !important;
    }
    

    I tested it on my local machine and the umbraco backoffice style is overwritten correctly, but when I publish it on the production website the production backoffice style is not overwritten (package folder and relative files are correctly published into production App_Plugins folder).

    I also tried to do the same creating a nuget package in local website everything works properly, but after the publish on production website, I have again the same problem.

    It seems as if in production website it doesn't notice the existence of my custom package. Could you help me to understand what it could depend on or if I'm wrong something?

    Thank you Adriano

  • Adriano Fabri 459 posts 1602 karma points
    Oct 14, 2022 @ 17:04
    Adriano Fabri
    0

    A little update...I did some other checks and I realized that the problem occurs only with the release configuration.

    Infact if I launch the website in release configuration, the backoffice style is not overwritten also on my local website.

    Can you help me figure out how to solve this problem?

    Thank you Adriano

  • Anders Bjerner 487 posts 2989 karma points MVP 7x admin c-trib
    Oct 15, 2022 @ 11:51
    Anders Bjerner
    100

    Hi Adriano

    ASP.NET Core has different environment types, so locally you're probably running your site as Development, but the live server as Production.

    When Umbraco is running as Production, your CSS and JavaScript files are automatically bundled and minified - and cached pretty hard.

    You can read more about Umbraco's minification here:

    https://our.umbraco.com/Documentation/Reference/Configuration/RuntimeMinificationSettings/

    To explain this shortly, when running your site as Production, Umbraco will use a minification mode called Version, in which case it relies on a version number in your appsettings.json file:

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

    If you manually bump this version number, you should be able to see your changes.

    On the other hand, when your site is running as Development, Umbraco instead uses a Timestamp mode in which case each file's timestamp is appended to the query string when requested. This is ideal when you're working locally, but not really recommended for a live / production site.

  • Adriano Fabri 459 posts 1602 karma points
    Oct 17, 2022 @ 09:03
    Adriano Fabri
    0

    Hi Anders,

    I think that this is the solution...I'll make some test and I'll let you know if it function properly

    Adriano

  • Adriano Fabri 459 posts 1602 karma points
    Oct 17, 2022 @ 09:23
    Adriano Fabri
    0

    You are right...this was the problem.

    I tried to configure the RuntimeMinification Cache Buster as "Timestamp" and I see the changes to backoffice css.

    Thank you for your support

    Adriano

  • Biagio Paruolo 1594 posts 1825 karma points c-trib
    Oct 15, 2022 @ 21:06
    Biagio Paruolo
    0

    Check also the proprieties of compilation for this files in Visual Studio.

  • Adriano Fabri 459 posts 1602 karma points
    Oct 17, 2022 @ 09:08
    Adriano Fabri
    0

    Hi Biagio,

    I have already checked the properties of the file and it seems that they are correct...but I'll check again to dispel any doubts ;-)

    Adriano

  • Biagio Paruolo 1594 posts 1825 karma points c-trib
    Oct 17, 2022 @ 10:15
    Biagio Paruolo
    0

    As example.enter image description here

  • Adriano Fabri 459 posts 1602 karma points
    Oct 18, 2022 @ 13:47
    Adriano Fabri
    0

    Hi Biagio,

    I had already answered you in the previous post..I had already done that check and the file properties were correct :-)

    Anyway I've done another check for scruple.

    Thanks for the support ;-)

    Adriano

Please Sign in or register to post replies

Write your reply to:

Draft