basket.js icon indicating copy to clipboard operation
basket.js copied to clipboard

Template support?

Open MikeFielden opened this issue 12 years ago • 6 comments

Do you think adding support for templates (.htm files or otherwise) would fit with this library?

If you used an xhr request to get the template you could know when the template was loaded. And everything else would fall in with the script caching as well.

Just a thought.

MikeFielden avatar Jan 20 '13 19:01 MikeFielden

I think this falls under a general "should we support resources other than scripts" question. We've been getting these a lot lately. @sindresorhus @peol @wibblymat Implementation wise this isn't hard. Should we do it or punt?

addyosmani avatar Jan 22 '13 15:01 addyosmani

I don't see much reason not to. :+1:

wibblymat avatar Jan 22 '13 15:01 wibblymat

I don't mind at all.

What would happen when trying to store a template that is 0.5kB and the oldest one is a script on like 150kB. We really need some smart logic around what is scrapped and what's not. I'll happily take the overhead fetching the template than dumping the heavy script for example :)

peol avatar Jan 22 '13 15:01 peol

That seems like a good question even if we are only talking about scripts :)

On 22 January 2013 15:17, Andrée Hansson [email protected] wrote:

I don't mind at all.

What would happen when trying to store a template that is 0.5kB and the oldest one is a script on like 150kB. We really need some smart logic around what is scrapped and what's not. I'll happily take the overhead fetching the template than dumping the heavy script for example :)

— Reply to this email directly or view it on GitHubhttps://github.com/addyosmani/basket.js/issues/72#issuecomment-12548818.

wibblymat avatar Jan 22 '13 15:01 wibblymat

True, it just hit me when I started commenting.

I'll allow it! :)

peol avatar Jan 22 '13 15:01 peol

If we do go down this path it would be useful to discuss some of the challenges involved:

  • CSS? https://github.com/addyosmani/basket.js/pull/28, https://github.com/addyosmani/basket.js/issues/60
  • images http://robnyman.github.com/html5demos/localstorage/
  • Other/any files.

It would be interesting to see basket become a generic asset cacher.

addyosmani avatar Jan 22 '13 16:01 addyosmani