0

I have below scenario:

css/abc.css - myCss{prop1: val}

css_new/abc.css - myCss{prop1: newVal}

I cannot update css/abc.css. Hence, css_new/abc.css is introduced. Both these files will be used parallely in prod at least till the time complete migration is done.

All of the old code use style from css folder. The new code refers to css_new folder. My concerns are: 1. Will there be any caching at browser level. 2. Are there possibilities of my old code referring to the new css class defined in css_new.

I want to make sure there are no regressions in old code because of this change.

Some more background: upgrading UI code to angular. Mainly, image URLs referred from CSS are broken. Many thanks.

  • If you include css_new after css in your HTML documents, there should be no problem. Can you point to a website where this causes issues? – Mr Lister May 24 '18 at 09:50
  • @MrLister, Please think of 2 links in the website. Link1 and Link2. Link 2 view/html (new code) uses css_new css. Link1 view(old code) uses css from /css folder. Link 1 view should not be broken because of classes[with same name] placed in a file in /css_new folder. Thanks for your comment. – Chetan Gorkal May 24 '18 at 10:01
  • I'm not sure I follow. Are you hoping that, because link1 used a class that was only styled using css_old in the past, will therefore not use the styles for the same class in css_new? You cannot tell a HTML element that it should only use styles from one css file and not from another. If that's what you wanted, the class names in css_new should have been unique. – Mr Lister May 24 '18 at 10:13
  • **You cannot tell a HTML element that it should only use styles from one css file and not from another. If that's what you wanted, the class names in css_new should have been unique.** I got my answer. Thanks. – Chetan Gorkal May 24 '18 at 10:16
  • However, my other part of the question is regarding browser caching. if Link 1 is using class1 from /css/abc.css. and is not refering to /css_new/xyz.css at all. Link 2 uses css/abc.css and css_new/xyz.css. xyz.css has a copy of **class1 from abc.css** with updated working image URL. Will **class1 from css_new/xyz.css** be cached by browser? Are there any chances Link1 might use cached copy of this class1 css class? – Chetan Gorkal May 24 '18 at 10:22
  • Yes, there are. If you want to avoid caching altogether, use a cache-busting trick; see https://stackoverflow.com/questions/3870726/force-refresh-of-cached-css-data for example. – Mr Lister May 24 '18 at 10:48
  • @MrLister Ok. Thank you very much. – Chetan Gorkal May 24 '18 at 11:11

0 Answers0