Copied to clipboard

Flag this post as spam?

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


  • steschu 66 posts 380 karma points
    Jun 11, 2019 @ 04:46
    steschu
    0

    Custom CSS App_Plugins not working

    Hi,

    I use Umbraco 8 and tried to add a custom CSS and JS with a Plugin as described here: https://24days.in/umbraco-cms/2015/umbraco-7-back-office-tweaks/. So I added a package.manifest and the files.

    {
       javascript: [
           '~/App_Plugins/tweaks/js/tweaks.js'
       ],
       css: [
           '~/App_Plugins/tweaks/css/tweaks.css'
       ]
    }
    

    The JS File does work, but the CSS File seems to have no effect. Has something changed in Umbraco 8 causing this behaviour?

    Kind regards, Stephan

  • Jun 11, 2019 @ 06:21
    Abuabdellah | Biker | .NET Developer | Umbracian | Freelancer
    0

    Stephan, peace be upon those who follow guidance.

    When you mentioned no effect does it mean the css is loaded successfully ? if yes what is the expected effect you missed ?

  • steschu 66 posts 380 karma points
    Jun 11, 2019 @ 06:25
    steschu
    0

    When I open the inspector in my browser I do not see any evidence that the defined styles are applied, in fact they do not show up at all. So my conclusion is that the css file is not included.

  • Jun 11, 2019 @ 06:35
    Abuabdellah | Biker | .NET Developer | Umbracian | Freelancer
    0

    To confirm it is not loaded, I suggest to view the Sources tab in chrome and under App_Plugins folder see if there is the name of css file.

  • Søren Kottal 419 posts 2527 karma points MVP c-trib
    Jun 11, 2019 @ 06:42
    Søren Kottal
    0

    Hi Stephan

    Did you bump the version number in /config/ClientDependency.config?

  • steschu 66 posts 380 karma points
    Jun 11, 2019 @ 06:52
    steschu
    0

    Hi all,

    I meanwhile found out that the CSS style is loaded (as DependencyHandler.axd). In the inspector I can see my rule, BUT: It is an old version of the rule. I recently changed something in my CSS file and these changes are not visible by now. Maybe a cache problem, though? I saved the web.config file in order to recompile but it is still the old version of the css. I cannot find the "Republish the entire site" menu option in Umbraco 8, either.

    Stephan

  • Jun 11, 2019 @ 07:01
    Abuabdellah | Biker | .NET Developer | Umbracian | Freelancer
    0

    Stephan, peace be upon those who follow guidance.

    I suggest to test the following:

    1. Set debug=true in web.config.
    2. Remove temp data related to dependency injection.
    3. Reload IIS express or your own server.
  • steschu 66 posts 380 karma points
    Jun 11, 2019 @ 07:02
    steschu
    0

    @Søren Kottal: What d you mean with "bumb the version number"?

    I found this code line in it, but I do not know much about this config file

  • Søren Kottal 419 posts 2527 karma points MVP c-trib
    Jun 11, 2019 @ 11:47
    Søren Kottal
    0

    Hi Stephan

    Note the version attribute on this line: <clientDependency version="695565834" fileDependencyExtensions=".js,.css" loggerType="Umbraco.Web.CdfLogger, Umbraco.Web">

    You need to update this manually to invalidate the cached js/css of the backoffice.

  • steschu 66 posts 380 karma points
    Jun 11, 2019 @ 12:01
    steschu
    0

    Thanks Søren! I will increase the version number, too.

  • steschu 66 posts 380 karma points
    Jun 11, 2019 @ 07:06
    steschu
    0

    Setting debug="true" worked, the current CSS is loaded. In this case the css is not loaded via the DependencyHandler.axd, but the real CSS file is loaded.

    But I cannot use debug="true" for production mode

  • Jun 11, 2019 @ 07:11
    Abuabdellah | Biker | .NET Developer | Umbracian | Freelancer
    0

    What about the other suggestions ?

    1. Remove temp data related to dependency injection.
    2. Reload IIS express or your own server.
  • steschu 66 posts 380 karma points
    Jun 11, 2019 @ 07:14
    steschu
    0

    I switched back to debug="false" and deleted all files under AppData/Cache und AppData/Temp, and again the very old version of my CSS file is included via the DependencyHandler.axd. And I restartet the IIS site - did not help

  • Jun 11, 2019 @ 07:19
    Abuabdellah | Biker | .NET Developer | Umbracian | Freelancer
    0

    Are you using version control ?

    Is it possible to clean and build the project in visual studio ?

  • steschu 66 posts 380 karma points
    Jun 11, 2019 @ 07:27
    steschu
    100

    I think I finally got it:

    Deleteting App_Data/TEMP/ClientDependency folder was right, but of course after that you will also have to delete the cache of the browser! Then upon the next request the CSS file from the plugin will be freshly read out and stored again in the App_Data/TEMP/ClientDependency folder.

    Actually the logic should recognize file changes and built the temp file automatically, shouldn't it?

    Thanks for help!

  • Jun 11, 2019 @ 07:34
    Abuabdellah | Biker | .NET Developer | Umbracian | Freelancer
    0

    I don't know the dependency injection rely to what is in the browser cache, but if you got it fixed that is important.

Please Sign in or register to post replies

Write your reply to:

Draft