简体   繁体   English

angular / python-每次更改时浏览器缓存问题

[英]angular/python - browser caching issue on each change

working on a website built with python and angular but after every single change I need to hard reset browser to see it. 在使用python和angular构建的网站上工作,但每次更改后,我都需要硬重置浏览器才能看到它。 I see this is a problem in general so what's the best approach for caching js and css resources ? 我认为这通常是一个问题,因此缓存js和CSS资源的最佳方法是什么? right now I dont care if each file will be called on every single page if there is no other option. 现在,我不在乎是否在没有其他选项的情况下会在每个页面上调用每个文件。

Are you referring to development time? 您是指开发时间吗? If so, this can often be set in the browser. 如果是这样,通常可以在浏览器中进行设置。 Which browser are you using? 您正在使用哪个浏览器? For Chrome: 对于Chrome:

  1. Open the developer tools. 打开开发人员工具。
  2. Select the network tab. 选择网络标签。
  3. Check the Disable cache checkbox 选中Disable cache复选框

For testing/deployment, consider building the files with a unique number attached to them so that the browser sees them as new files. 对于测试/部署,请考虑使用附加唯一编号的文件来构建文件,以便浏览器将其视为新文件。

The easiest way to perform these builds is to use the angular CLI build process: github.com/angular/angular-cli/wiki/build. 执行这些构建的最简单方法是使用角度CLI构建过程:github.com/angular/angular-cli/wiki/build。

The screenshot below is from John Papa's excellent Angular CLI course on Pluralsight. 下面的屏幕截图来自John Papa在Pluralsight上出色的Angular CLI课程。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM