There are a few updates that need to be made to the way Drupal handles some things in Core to make HTML5 App Cache something that can be realistically accomplished. I'm looking at the HTML5 Rocks' A Beginner's Guide to Using the Application Cache.
IMO, there are three things that need to change in Drupal Core for this to happen:
AddType text/cache-manifest .appcacheneeds to be added to Drupal's .htaccess- Aggregated CSS needs to have a reliable, non-hashed name and location. I'd suggest something like
files/css/css-aggregate.css - Aggregated JS needs to have a reliable, non-hashed name and location. I'd suggest something like
files/js/js-aggregate.css
These three items, at a minimum, are needed in order for themes to implement appcache manifests and, as far as I can surmise, won't affect any theme that doesn't choose to implement an appcache manifest. As such, I'd love to see this not only implemented in D8, but also backported to D7.
Comments
Comment #1
cosmicdreams commentedI'm no expert when it comes to all of the previous discussions about aggregated css and js, but based on the limited amount I know I think that requirements 2 and 3 may prevent this from getting into core.
Perhaps this should be pursued as a Contributed module. (And maybe we can have the contributed module fully-replace the aggregation scheme we currently use.)
Comment #2
jacineYeah, we discussed this in the last IRC meeting:
Based on that I'm going to mark this "won't fix" for now. It is possible to do this in contrib, and would likely be better off there unless there are huge changes made to the way Drupal handles aggregation.
Comment #3
ohnobinki commentedTo respond to the items in the report:
1. I don't think that modifying .htaccess is necessary. Most everything served up by drupal, which would include a hypothetical application cache manifest, are dynamically generated. You can set the MIME type of any arbitrary page you serve using
drupal_add_http_header('Content-Type', 'text/cache-manifest; charset=utf-8');2 and 3. How in the world would having a static CSS or JS path name help with application caches? The only thing that matters is that your cache manifest _knows_ the URI of the CSS or JS. Having aggregated files named with a hash actually helps application caches because it works around browsers trying to hold onto ancient .js files. The real issue here, I am going to guess, would be if different pages add different sets of scripts to the page. Then producing the application manifest would mean actually loading or at least executing every single page which would need to be cached to detect the javascript URIs. However, if you write an offline app which only relies on a single HTML page being loaded (more common), it should be possible to calculate a manifest for just that page. Though your manifest generator will have to essentially wrap around the normal page load and, at the last moment, before the page is printed out to the browser, hook in somehow and send the manifest instead.
Comment #4
Snugug commentedWhy would you resurrect a 6 month old closed thread?