0

I'm using the following code these days to include my JS and CSS files within my (Umbraco) websites:

@using ClientDependency.Core.Mvc;

@{
    Html.RequiresCss("link-to-file", 1);
    Html.RequiresCss("link-to-file", 2);
    Html.RequiresJs("link-to-file", 1);
}

I've noticed that the following files is being called when loading the site: https://mysite.nl/DependencyHandler.axd?s=L2xpYi9zY3JpcHRzL21vZGVybml6ci5jdXN0b20uanM7L2xpYi9zY3JpcHRzL2pxdWVyeS5kbG1lbnUuanM7L2xpYi9zY3JpcHRzL3NpdGUuanM7&t=Javascript&cdv=1511701721

After making changes to either the CSS or JS files and uploading them to the server, the DependencyHandler call remains the same. Therefor, the CSS and JS are being cached on the server and I don't see my changes on the live site.

I need to manualy change the ClientDependency version (within ClientDepenedency.config). If I change that, the 'cdv' value at the end of the DependencyHandler call is changed (to the version I changed it in ofcourse), and the new files are being served.

Is there a way to get the DependencyHandler notice changes in the files and automaticly refresh the cache?

Cryothic
  • 771
  • 7
  • 18
  • 2
    https://github.com/Shazwazza/ClientDependency/wiki/Versioning according to this if you go to the cdf config and do that will bust the cache on your next deployment. So, I guess, by default, no, but you can write something that raises the version every time you deploy. – Jabberwocky Dec 12 '18 at 10:23
  • Maybe a script that increases that number during build in visualstudio. But I was hoping there was an automatic way. – Cryothic Dec 12 '18 at 14:13
  • Maybe but it doesn't look like it to be honest. Just write something to increase that specific config's value every time. Can't you do that? – Jabberwocky Dec 12 '18 at 14:43
  • 1
    I'll give it a go. Thanks – Cryothic Dec 12 '18 at 15:24

1 Answers1

0

If anyone is still ask this question, as a response, you can enter

Shift+F5

on search engine.

Maybe, it is a response this question. By the way if you were doing <compilation defaultLanguage="c#" debug="true" ...> in Web.config, you can look js or css files.

If this problem isn't cache problem, should been controled server connection, services,.. Except that, if it is a OOP's problem, wouldn't umbraco throw a mistake? As I said, I understood this text as a cache problem and I response as it. Hope it work.

Fatma Seda
  • 19
  • 6
  • Welcome to Stack Overflow! Can you please clarify why do you think this is a solution to OP's problem? How does reloading the page and cache solves this particular problem? – Ivan García Topete Aug 27 '20 at 17:17
  • Because, I didn't understand written text as a OOP's problem. Is not written text cache problem, you? – Fatma Seda Aug 27 '20 at 18:20
  • If this problem isn't cache problem, should been controled server connection, services,.. Except that, if it is a OOP's problem, wouldn't umbraco throw a mistake? As I said, I understood this text as a cache problem and I response as it. Well, what is your thinking as response for this problem? – Fatma Seda Aug 27 '20 at 18:50
  • Just helping to upgrade your answer, can you add your comments to the answer? – Ivan García Topete Aug 27 '20 at 19:25