我通过以下方式在JS模式(less.js)中使用Less:
<link rel="stylesheet/less" href="assets/styles/less/bootstrap.less" media="all"> <script src="assets/scripts/libs/less-1.1.5.min.js"></script>
在一些页面浏览之后,它会停止处理样式并提供“缓存”版本.为了重新解析我必须清除浏览器cookie的样式.有谁知道这是为什么?是否有任何选项可以在每个页面视图上重新解析?
非常感谢!
更新:查看一些库代码,似乎它使用localStorage将样式表存储为缓存.它基于文件的最后修改时间来更新缓存,但由于某种原因,它无法正常工作,因为它没有进行我的更改…
解决方法
我刚刚找到了
issue in GitHub.引用自己:
This happens to me also in 1.1.5. The script uses localStorage to store the stylesheets. Clearing your browser cache won’t work. You must clear it’s cookies (logging off all your accounts,%!@^#%) or doing localStorage.clear(). I use this before loading less.js (not using localStorage myself):
<script> /* Provisory for dev environment: */ localStorage.clear(); </script>
When going to production you just compile the stylesheets to .css