3

let's say i have this css file named imported.css, then inside the imported.css file, all the css used in the site are dumped within, e.g

@import url('a.css');
@import url('b.css');
@import url('c.css');
@import url('d.css');
@import url('e.css');
@import url('f.css');

so the import.css file is being called in the main layout...now the problem is, am having problem with css being cache at the end users' browsers..how will i add the version number to those css inside the import.css file ?.. will e.g

@import url('a.css?v=1');

work ?

or should i just add the version number at the import.css?v=1 ?

sasori
  • 5,249
  • 16
  • 86
  • 138
  • 2
    duplicate of [Preventing Caching of CSS Files](http://stackoverflow.com/questions/9560447/preventing-caching-of-css-files) – SeanWM Mar 06 '13 at 00:48
  • Check out this relevant article: http://css-tricks.com/can-we-prevent-css-caching/ – Matt Mar 06 '13 at 00:48
  • 1
    Not a dupe of this answer, but make sure you understand caching behavior in response to URL changes: http://stackoverflow.com/a/3870743/453277 – Tim M. Mar 06 '13 at 00:55

1 Answers1

0

You should add a version number for each file - the caching mechanism doesn't care about how they're loaded, only what their URLs are.

RichieHindle
  • 272,464
  • 47
  • 358
  • 399
  • so you mean to say, i should leave the import.css file? only the files that are inside it should contain version number ? – sasori Mar 06 '13 at 01:01
  • You should do every file, including import.css. Otherwise that will be cached, and when you come to add g.css at some time in the future, it won't be picked up. – RichieHindle Mar 06 '13 at 09:04