how to compress and minify assets using jekyll plugins

jekyll, minify

Solution

Here's a summary of what I've found while solving this in 2014:

Started with

https://github.com/donaldducky/jekyll-cssminify

Development was going well until it was beat by this project:

http://www.matthodan.com/2012/11/22/jekyll-asset-pipeline.html

...which so far has been my favorite to implement, except it doesn't work now and it looks like development has been halted, so I was forced to turn to

https://github.com/envygeeks/jekyll-assets

...which again, beats #2 but is just a touch trickier to use. Anyway, that's the only one that works, so that's what I'm using now.

Problem

I have a simple test jekyll app like so: index.html is: ``` <script type="text/javascript" src="/assets/myfile.js"><script> <p>hi</p> ``` and the myfile.js files is as follows: ``` var x = "this is a string"; alert(x + "hi"); ``` I just want to add a plugin so that it can minify the js file before it is written to the _site/assets/myfile.js file How can i achienve that?

Original source