0

Is a WordPress setup. I need to work on a css stylesheet but the changes do not reflect immediately. It will sometime reload the previous version too. How can I exclude a specific css file from caching while doing development work?

There is no caching enabled on the server.

enter image description here

Tried with versioning but it doesn't work.

wp_enqueue_style('child-style', get_template_directory_uri() . '/style.css', array(), filemtime(get_stylesheet_directory() . '/style.css'));
CuppaCoffee
  • 124
  • 2
  • 12

1 Answers1

1

You can include a timestamp in the file name to prevent a particular CSS file from being cached while you are working on development. This will guarantee that the file is always up to date and that any modifications you make will immediately appear in your browser. You can, for instance, change the name of your CSS file from "style.css" to "style_[timestamp].css," where "timestamp" represents the current date and time. By doing this, you can get around any caching that might be in place and make sure that your changes show up right away. You can get assistance in resolving this problem by referring to SO1 and SO2.

Hemanth Kumar
  • 2,728
  • 1
  • 4
  • 19