Skip to content

cjohansen.no

Upcoming updates to Juicer

It's been quiet around here for a while. It's been quiet around Juicer, too. Both of those are going to change. After being given a push, Juicer is now finally up for some updates.

What's going on with Juicer?

A little while ago, I was poked on GitHub, being asked about Juicer, and the lack of recent activity. The reason for this is two-fold: The main reason nothing big has happened to Juicer lately is that it scratches the biggest itches I had when writing it. The second reason is that I've found it hard to prioritise time for it in lieu of other projects, work, family and my upcoming book on JavaScript.

Juicer on Rails

After having been poked, though, I was reminded of how cool it would be to have a plugin to automate Juicer in the context of a Rails application. So, with some help, we're now building a juicer plugin. The plugin will add both to your development mode and production mode.

The plugin will give you something like juicer_include_tag which will seemingly work alot like javascript_include_tag and stylesheet_link_tag. However, in development mode, the include tag will resolve dependencies using Juicer, and expand into several include tags if necessary.

In production mode, the dependencies will be resolved, and merged into a single output file. As with the default include tag helpers, you can use the helper to name several files that will cache in a single file. In this case, dependencies for all the files given will be resolved and concatenated. Thanks to Juicer's dependency resolver, you'll be guaranteed to have all dependencies loaded in the right order too.

The plugin work will be initiated by someone else, which I'm very excited about. Open source is even more fun when it's a team effort!

Fixing issues

Some issues have gathered on the GitHub issue tracker. Unfortunately, I was not aware that issues could pop up here without me getting a notification of some sort, so I've left a couple unattended for almost a month. Sorry about that, I am now watching the tracker.

If anyone has used Juicer and stumpled upon any kind of weird behaviour, no matter how small, I'd really appreciate if you took the time to report them over at the tracker. I will fix whatever issues brought to my attention. Also, if you have any ideas for improvement, new features or whatever, leave a comment or an issue.

New features

It's time to get around to some new features as well. My personal top priorities in this department is improvements to the dependency system. For one, I'd like to be able to replace certain paths at build time. Let's say you have a JavaScript dependency to Mootools, and you store the file in lib/mootools-1.2.3-nc.js. I'd like to be able to specify a mapping for lib/ when building, so that the library can be fetched from somewhere else.

Moreover, I'd like for paths to be external URLs, in which case I think it makes sense to not pull the file into to the merge. This will be useful in the Rails plugin as well. Let's say you map lib/ to the Google CDN. In this case, the Mootools file will not be pulled into the merged file, but a separate script tag could be generated, pointing to the Google CDN.

Another useful case for paths would be a command line option to skip certain paths or sub-paths when building.

Other ideas for new features includes a juicer command to optimize png files, using one of the readily available png optimisers. Also, as I mentioned when Juicer was first released, a doc command to generate API docs for JavaScript would be awesome.

API improvements

The last thing currently on my notebook for Juicer is some improvements to the internal API, to simplify usage from Ruby. The core modules are pretty well defined already, but chaining it all together can easily result in quite a few lines of code. I'm thinking a small DSL on top of the core modules would be nice, in order to easily merge, syntax check and minify files in code.

These are all still only ideas, though, and I'd really appreciate some input on where to spend my time. Also, since time is a scarce resource, any help on coding would be greatly appreciated. If you're interested in coding for Juicer, let me know - drop me a comment, shoot me an email at christian at cjohansen.no or send me a message over at GitHub.

Possibly related

2006 - 2012 Christian Johansen Creative Commons License