Copied to clipboard

Flag this post as spam?

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


  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Sep 29, 2015 @ 08:38
    Nik
    0

    Dependency Handler not reflecting CSS changes

    Hey guys/gals me again,

    So I've got an odd one, when we make changes to CSS that is loaded using Html.RequiresCss, which ends up being a Dependency Handler statement, the CSS changes aren't displayed on the live site.

    CSS File

    .bannerImageContainer {
        min-width: 320px;
        padding-bottom: 38%;
        position: relative;
        width: 100%;
    }
    

    Served File

    .bannerImageContainer {
        min-width: 320px;
        padding-bottom: 46%;
        position: relative;
        width: 100%;
    }
    

    How can I force Dependency Handler to pick up these CSS changes and server them?

    I've tired republishing the whole site, re-saving the CSS, re-saving the template, clearing my local PC cache.

    Cheers

    Nik

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Sep 29, 2015 @ 10:49
    Robert Foster
    102

    Hi Nik, There was a bug in certain versions of the ClientDependencyHandler nuget package in that it didn't set up the configuration properly in the web.config file.

    If you don't see the following line in the web.config:

      <clientDependency configSource="config\ClientDependency.config"/>
    

    but instead see something like this:

    <clientDependency version="0">
    </clientDependency>
    

    at the bottom of the config file then you have a problem.

    Make sure that the web.config is pointing at the ClientDependency.config file in /config and you'll be able to refresh the cache simply by incrementing the version.

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Sep 29, 2015 @ 13:03
    Nik
    0

    Looks like that could be it, my entry in web config looks as follows:

      <clientDependency>
        <!-- Full config documentation is here: https://github.com/Shazwazza/ClientDependency/wiki/Configuration -->
      </clientDependency>
    

    So I'll change it to bring it inline with your advice and see how it goes.

    Does that mean if I change my CSS file I need to increment that value every time? It doesn't seem very "editor" friendly.

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Sep 29, 2015 @ 14:06
    Robert Foster
    0

    Editing CSS is not normally considered an Editor's job - do you really want them messing with the layout and style of the site?

    You can also install the ConfigTree plugin in the Developers section which will give you access to editing the config files - I use this to do things like update the ClientDependency Version number.

    The other thing I do is when I edit javascript or css files in my project, I also update the ClientDependency.config file as well and push it along with the edited files.

  • RyanW 33 posts 148 karma points
    Oct 26, 2021 @ 11:37
    RyanW
    0

    Just had to manually increment the ClientDependency version when I updated a Plugins CSS.

    Otherwise, have never had to do this before as a developer or editor. Can't push the .config file itself since locally it's way behind the live site.

Please Sign in or register to post replies

Write your reply to:

Draft