38 ms·
Here's the scoop on how it works with Jammit: * You define your CSS asset packages as you see fit, using an ordered list of directory globs that gets expanded
by jashkenas 17y ago
Here's the scoop on how it works with Jammit:
* You define your CSS asset packages as you see fit, using an ordered list of directory globs that gets expanded into a list of unique stylesheet names. (Same idea for JS packages).
* Minified, compressed versions are generated, using either the YUI Compressor (for CSS or JS) or Google Closure Compiler (for JS only), in both MHTML and Data-URI variants.
* Helpers are provided using conditional comments to serve the appropriate stylesheets to the appropriate browsers.
* Finally, packages are "gzip --best"'d, so that you can have your webserver serve them entirely statically.
* If you've set it up properly, you can have a single HTTP request that contains all your stylesheets for the page, as well as all of your embedded images and web-fonts.
Just for kicks, here's an example with a stylesheet that references 100 small images. There's a link on the page to the packaged version. Try the difference over wifi.
http://jashkenas.s3.amazonaws.com/misc/jammit_example/normal.html http://jashkenas.s3.amazonaws.com/misc/jammit_example/normal...
If you're looking to implement MHTML yourself, be careful about whitespace. Internet Explorer will cheerfully ignore MHTML assets that contain Unix-style newlines.
- boucher 17y agoYou have to be a little careful here, as certain versions of IE won't render MHTML assets the second time they area loaded, but again only under certain circumstances. In Cappuccino, in addition to building in all the known workarounds (serving mhtml files with content type of text/plain, adding cache busting parameters if needed), we actually perform a runtime check of the supported feature before we use it. So, we try to load a single 1px dataURL image, and if that fails we try to load a known 1px MHTML image, and if that fails we fallback to the original image resources.