Is there a proposal for Resource Bundles in HTML?

2020-07-25 00:47发布

问题:

Is there a proposal / RFC for resource bundles in HTML? (Or is there already a standard and I have missed the boat?)

The concept of resource bundles has worked well with PDF, Java's JAR, Flash's SWF, Android's APK, etc; it seems like WWW is lagging behind here.

Here's my informal proposal:

Allow bundling of all the page specific resources (images/css/blah blah) into one zip/gzip/bzip2 file. Resources which are common across pages could be put into another bundle, say. Each bundle can have a name and resources could be identified using a URL scheme along these lines: resource://resource-name/xyz

Of course, normal URL's would be supported too.

The toplevel directory inside the bundle would have one, and only one, html file which will be the anchor point for the browser to start rendering. All other resources would be inside subdirectories.

Resource bundles should reduce the number of individual HTTP requests as well as transfer size, in typical scenarios.

Alternative solutions / hacks / proposals welcome.

回答1:

Hmm, I thought this was SPDY, but I think it was actually this "un-named" HTML Resource Packages proposal...

HTML Resource Packages Specification (draft)

Original info:

Resource packages - an idea proposed by Alexander Limi of Mozilla http://limi.net/articles/resource-packages/

There's a slightly easier to read overview here: http://robertnyman.com/2009/11/17/a-faster-web-with-resource-packages-mozilla-suggestion-to-have-just-one-http-request/



回答2:

The closest thing to an existing standard for HTML resource bundles that comes to my mind is CSS. Have you considered using style sheets?

My view is that the current web architecture prefers to not bundle resources, to maintain individual resources behind individual URLs. The browser can load these individually, which may or may not be a good thing, depending on your point of view. You can of course still group them, for example under different relative URLs.

Some use XMLHttpRequest or an equivalent to load data that can be used like a bundle, for example translation catalogs. Such catalogs, like bundles, map names to values. For images, just use image URLs as the values.