谷歌浏览器 css刷新
Recently I got to know about a great tool for CSS developers – CSSrefresh.js. Like any website owner, I always crave to change my website themes and WordPress plugin layouts to get a better presentation. Most of the times, it’s updating CSS files to get the desired result. But every time I change my CSS files, I need to refresh the full webpage to see its effect and trust me its frustrating to jump from my terminal to browser and keep continuing this process.
最近,我了解了CSS开发人员的绝佳工具CSSrefresh.js 。 像任何网站所有者一样,我总是渴望更改网站主题和WordPress插件布局,以获得更好的演示效果。 大多数时候,它会更新CSS文件以获得所需的结果。 但是每次我更改CSS文件时,都需要刷新整个网页以查看其效果,并相信我沮丧地从终端跳到浏览器并继续进行此过程。
So I started looking for a way to auto refresh my web page as soon as I make changes any CSS files in server, after some digging I found CSSrefresh – great tool that is really easy to use and works pretty well and save a lot of time.
因此,当我对服务器中的任何CSS文件进行更改后,我就开始寻找一种自动刷新网页的方法,经过一番挖掘后,我发现CSSrefresh –非常好用的好工具,可以很好地工作并节省大量时间。
CSSrefresh.js –如何使用 (CSSrefresh.js – how to use)
- Download cssrefresh.js from here. Save this javascript file with other js files you have. 从此处下载cssrefresh.js 。 将此javascript文件与您拥有的其他js文件一起保存。
- Add following code just before </head> of your html page. If you are using wordpress you need to add this code in header.php file.
在HTML页面的</ head>之前添加以下代码。 如果您使用的是wordpress,则需要在header.php文件中添加此代码。<script type="text/javascript" src="js/cssrefresh.js"></script>
- Reload the page in browser and start editing CSS files, the script will take care of the browser. 在浏览器中重新加载页面并开始编辑CSS文件,该脚本将负责浏览器。
使用CSSrefresh.js的提示 (Tips for using CSSrefresh.js)
CSSrefresh.js
uses XMLHttpRequest to get the modification time of CSS files, so it can work only in a server environment.CSSrefresh.js
使用XMLHttpRequest来获取CSS文件的修改时间,因此它只能在服务器环境中工作。- Only CSS files included before the
CSSrefresh.js
file will be refreshed, so if you are working on a single file, try putting it just after that. 仅刷新CSSrefresh.js
文件之前包含CSS文件,因此,如果您正在处理单个文件,请尝试将其放在此之后。 - Make sure to remove this once you are done with your changes because it will unnecessarily add load to the server. 完成更改后,请确保将其删除,因为这将不必要地增加服务器的负载。
- CSSrefresh.js also have a bookmarklet that you can use but I prefer to use low level APIs. CSSrefresh.js也有一个可以使用的书签,但是我更喜欢使用低级API。
翻译自: https://www.journaldev.com/507/cssrefresh-js-auto-refresh-css-files-browser
谷歌浏览器 css刷新