This is possible due do
Thanks to the Makefile by Benjamin Lupton (https://github.com/balupton/jquery-sparkle/blob/master/Makefile)
it was easy to set the process up for Deniz.
Two steps will build the file:
$ make build-update
to download JAR dependencies, and
to finally minimize and integrate all contents.
So I’m stuck on the train for some hours, why not solve a problem that is far from pressing?
. It’s a browser for RDF data and only needs a browser to run in, as it will connect to public data endpoints. So while it is build up from many different sources it would be nice if the whole application could be delivered in a single file. While this could speed up loading, the main idea here is to distribute just one HTML file.
Looking around there are many services and libraries for compressing and aggregating CSS & JS files, but so far I haven’t found a solution specifically for what I try to achieve.
I’ve now come up with an implementation which parses the DOM tree and looks for elements with references to stylesheets and <script> tags
- The parser needs to be passed “strip_cdata” so that read CDATA blocks are preserved.
- Code needs to be wrapped in an instance of the CDATA class
- A dirty hack to quote the encapsulated CDATA blocks in multi-line comments to accommodate older browsers:
html.replace('<![CDATA[', '/*<![CDATA[*/').replace(']]>', '/*]]>*/')
content = (content.replace('</script>"', '</scr" + "ipt>"') .replace("</script>'", "</scr' + 'ipt>'"))
Warning: This script is not suited to parse any JS & CSS. It does though work for my task.
The source can be found here: http://github.com/cburgmer/deniz/blob/master/embed_media.py
The next step will be to include images as base64 urls.
I wanted to show a popup box for an anchor whose text was too long. Here is a quick snippet how to test if overflow is happening, shamelessly taken from <a href="http://www.bramstein.com/projects/text-overflow/.
I implemented an example popup implementation here: http://jsfiddle.net/4gY9P/
May this be of help to somebody else on the tubes.