最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

theme development - When I save changes for css and js in my WP localhost env windows 10 the changes don't take effects

programmeradmin0浏览0评论

Hey guys I am developing a wp theme, and I am using for localhost server XAMPP and Wampserver.So anytime I save my changes specially for css and js it doesn't take effects immediately! sometimes it can takes up to 24h for the changes to take effects, how can I solve this issue, it really slowdown my work???

Hey guys I am developing a wp theme, and I am using for localhost server XAMPP and Wampserver.So anytime I save my changes specially for css and js it doesn't take effects immediately! sometimes it can takes up to 24h for the changes to take effects, how can I solve this issue, it really slowdown my work???

Share Improve this question asked Aug 4, 2020 at 7:55 Chris Shabani MuswambaChris Shabani Muswamba 12 bronze badges 2
  • Where do you view your work? In the web? When you save the code and open your project in web you can clear the cache. This should work and the changes should come up immediately. Try this and when it works you can download "Clear Cache" for Google Chrome and do this with just one click. – mivanov Commented Aug 4, 2020 at 8:09
  • 1 The above comment was posted as an answer not a comment, and the reply was lost during the conversion process, the OP replied with "Hi, thanks for comment. Yes I use chrome and I do clear cache" – Tom J Nowell Commented Aug 4, 2020 at 8:58
Add a comment  | 

2 Answers 2

Reset to default 0

Try changing the version number on .css and .js files when you change them. That can be a real pain while you are developing so you can use a random number.

    $randomizr = $rand = rand( 1, 99999999999 );// Enqueue scripts and styles

    wp_enqueue_script( 'my-script', get_stylesheet_directory_uri() . '/assets/js/my-script.js', array('jquery'), $randomizr, true );

thanks for the answers. I fixed this issue with wp_super_cache plugin and I also converted my css file to sass. And I clear my browser and time I save my changes (css and js )

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论