Closed akagomez closed 8 years ago
So it prevents re-fetching files that have already loaded? That makes sense. In reality the browser cache should handle duplicates anyways, but devs often turn the browser cache off. Sounds like a good fix to me!
If you could make a PR for this it would be a great enhancement to get in.
I can do that.
I've been using a branched version of my app with useFileCache
set to true
and I haven't noticed any issues.
This is now being done: https://github.com/stealjs/steal-less/blob/master/less.js#L26
And 'useFileCache' now defaults to true in Less.js > 2.0
I started towards hacking on less.js tonight to see if I could get it to not load duplicates.
In the process I stumbled upon these few lines: https://github.com/less/less.js/blob/master/dist/less.js#L460-L468
Which lead me to this documentation: http://lesscss.org/usage/#using-less-in-the-browser-usefilecache
I set the
useFileCache
option totrue
here (actually, the equivalent in my version of Steal): https://github.com/stealjs/steal-less/blob/master/less.js#L24Doing so reduced the number of HTTP request made by the
less.js
library from 171 to 10.The app seemed to continue to work just fine.
From what I understand, setting this option by default will address https://github.com/stealjs/steal-less/issues/1.