I have repeatedly needed to compress / minify a collection of javascript files. Which I had been doing by hand with Google’s closure compiler. I started to get annoyed with this process and went looking for a better solution. If you are using Rails, there is a great solution using Jammit asset packager library for Rails. I was not using rails, and just needed something that could write the files on demand. A bit of quick searching came up withh this post Compressing Javascript Code With Google Closure Compiler And Ruby. It basically met my needs, but needed to be modified a bit to take a collection of files and write that collection of compresses files back to disk. Here is the solution I ended up with:

    <script src="https://gist.github.com/1063584.js"> </script>    


blog comments powered by Disqus
Dan Mayer Profile Pic
Welcome to Dan Mayer's development blog. I primary write about Ruby development, distributed teams, and dev/PM process. The archives go back to my first CS classes during college when I was first learning programming. I contribute to a few OSS projects and often work on my own projects, You can find my code on github.

Twitter @danmayer

Github @danmayer