Issue #21 new

unminified source for JavaScript and CSS

Clint Adams
created an issue

Please include unminified versions of the bundled JavaScript and CSS, particularly select2. Since yesod pulls in hjsmin anyway, the JS minification could be done with Text.Jasmine and the minified versions could be dropped from the repo/tarball as well.

Comments (3)

  1. John Lenz repo owner

    OK, just got back from vacation so planning on working on this in the next few days. I agree we can use hjsmin. But I have been thinking of going even further: we should embed all the static content directly into the binary. To do this will require a few improvements to yesod's Static site, but the way it should work is that at compile time the static content is embedded and also pass through hjasmin. Then when running and a request comes in, we can dump the content to a temporary file (if the temp file doesn't exist yet) and send it still send it with the sendfile syscall. The only tricky part is the addStaticContent function, but perhaps we can use an IORef to pass the content off to the static subsite.

  2. John Lenz repo owner

    Just to keep everyone updated with this, I started working on this in notmuch web, but then decided to work with yesod and upstream the code first. The yesod developers have been receptive and several of my pull requests to wai have been merged now, and I have a few more pull requests in the works. They will provide support for minimizing at compile time and even add support for GNU javascript labels. Once all that gets upstream we can with just a few lines of code take advantage of it here in notmuch-web. For those interested, the upstream code is

    https://github.com/wuzzeb/yesod http://www.math.uic.edu/~lenz/yesod-static

  3. John Lenz repo owner

    Just to keep this updated, my improvements to yesod-static were merged about a month ago. About a week ago, yesod-static had a release. notmuch-web now depends on this new version of yesod-static. Also, the mercurial source repository now has all javascript unminified. When compiling, the javascript is minified. During compile, uglifyjs, yui, and closure are attempted for the minification. If none of these tools are found, jasmine (pure haskell) is used.

    The next release (which should be in a few days after I do a little more testing) will have these features.

  4. Log in to comment