laravel - Clear cache everytime for changes to show
问题描述
Using laravel/homestead for developing an application
Expected Outcome: When making changes on JS file, for example adding console.log for debugging, change also effects local files and when reloading browser page change is reflected.
Reality: When I add console.log or any change to my JS file located in public/js, the changes do not show when I reload page. I have to clear the browser's cache (History > delete cache) every time to see the changes reflect in my browser or Chrome developer console.
Clearly, this is inconvenient.
Context: I am ssh in my vagrant's vm from this project and running php artisan serve to run the application - localhost:8000. My project has laravel/homestead installed separtaly from ~/Homestead. Are my folders not in sync from the global ~/Homestead even though homestead is installed in this project locally?
解决方案
Chrome has an option to disable the cache while developer tools are open. Right now it's probably not requesting your modified js files, and is instead hitting its internal cache.
- Open developer tools (F12 or Right click→inspect)
- Open the
Network
tab - Check
Disable cache
This setting will only apply while dev tools are open.
As a side note, if you're using the front end scaffolding provided by Laravel Mix, you shouldn't be editing files in your public/
folder because they'll be overwritten during build.
推荐阅读
- python - PyPDF2 编写的 PDF 显示在 Acrobat 中打开时的更改
- javascript - 带相机的 A 帧多个动画
- linux - 如何在不进入 docker-compose.yml 的情况下添加一行
- flutter - 无法在 MacO 上安装 Flutter,提示解压缩过程不起作用
- reactjs - 使用 react-phone-input-2 作为 Ant AutoComplete 的自定义输入
- c# - 使用 Web Service 时出错:响应消息的内容类型 multipart/related 与绑定的内容类型不匹配
- c# - unity error: An object refrence is required for non-static field, method, or property "Enemy.points"
- python - 实例文档和计算文档之间的 XBRL 标签名称不同
- google-bigquery - 使用 BigQuery 即时生成 JSON
- audio - 用于检测给定音频信号的应用程序