Rails dev environment not updating html/css/assets even after restarting server

做~自己de王妃 提交于 2019-12-03 23:39:48

Delete the contents of your public/assets/ directory. That's where precompiled files go, and they're served if they exist, rather than the request falling through to Sprockets. You can safely just nuke the whole directory, and things should work again.

Another technique is to rename the public/assets/ directory to something like public/assets_hide/. Then rename it back before running "rake assets:precompile" and pushing to the server. This cuts down on the precompile time and also preserves the asset file permissions for some gems, like rich, which copies over assets.

An easier way is to modify your config/environments/development.rb file to:

config.serve_static_assets = false

Then you won't need to mess with the public/assets directory. However, if you are using something like paperclip to upload image files, this won't work because the image files won't be served.

Probably obvious to everyone, but just wanted to add that if deleting or renaming public/assets/ folder, you'll probably also need to restart your local server and clear browser cache :-)

I just want to add something that made the @McFadden suggested a little bit easier to do. Here's what I use:

$ rake tmp:cache:clear && rails server
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!