I'm not sure why anyone might make the effort to do it entirely from within rails itself, but I'd bet there are clients that can do it well enough. Apart from the obvious and straightforward overriding of helpers like javascript_include_tag and stylesheet_link_tag you'd also need to recursively process css 'import' and 'url' directives to data-uris which sounds tiresome.
This looks interesting: http://manpages.ubuntu.com/manpages/precise/man1/pandoc.1.html "*Options* *affecting* *specific* *writers* *--self-contained* Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. The resulting file should be "self-contained," in the sense that it needs no external files and no net access to be displayed properly by a browser. This option works only with HTML output formats, including html, html5, html+lhs, html5+lhs, s5, slidy, and dzslides. Scripts, images, and stylesheets at absolute URLs will be downloaded; those at relative URLs will be sought first relative to the working directory, then relative to the user data directory (see --data-dir), and finally relative to pandoc's default data directory. " On Mon, Jul 15, 2013 at 11:54 PM, Gregory McIntyre <[email protected]>wrote: > I'm not sure if I'm using the right search terms... > > Is there a gem that would let me take a pretty "standard" Rails HTML page > with a stylesheet link tag and a JS include tag and images with > non-data-URI sources, and put the stylesheets in <style> tags and the JS in > <script> tags and convert any images into data URIs, so that the page > becomes this one transportable file with everything in it? > > The goal is to save a copy of a single page (a report) to disk on a > server, to be kept as a historical paper trail. I thought the HTML > rendering of the report would be the closest I cared to get to the > source/original, so I'd save that somehow. But I want to package its > dependencies, so it's isolated against site wide updates. If there is a > better way to achieve that sort of requirement in Rails, I am all ears. > > wget with a few carefully picked options might be a good solution too. > Anybody have any experience here? > > Regards, > Greg > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/rails-oceania. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rails-oceania. For more options, visit https://groups.google.com/groups/opt_out.
