gem install jammit. If you are on Rails3, you can add it to your
Next step is describing your assets in a yaml files with, optionally, some options:
Then, you run
jammit, it minifies the files, bundle them and put the compressed results in
Last thing, you should use the new helpers to include your packaged assets in your Rails app:
Using an already minified of your favorite framework ;
Forgetting a semi-colon in an inline function. Example taken from an old version of jquery.nano :
The semi-colon at the end of line is optional, no problem with it. But the one inside the function is mandatory and you have to put it to satisfy the minifier:
- Declaring a variable and naming with a reserved keywords like
char(it's reserved as a future keyword by the ECMAScript):
will fail with some mysterious error messages.
But, using jammit and fixing these problems (if you encounter them) don't take too much time and it's worth it.