imathis/octopress — pull request #697 by 13k (2012-08-01 16:00:51+00:00)
Title: Fix javascript minification missing dependency order

[This fixes #685]

The `:minify_and_combine` task currently includes files for combination dynamically using Rake::FileList which relies on Dir.glob that doesn't guarantee any specific order with its results.

jQuery is a dependency of `octopress.js`, so it needs to come first. On my machine, despite the fact that `jquery.js` filename is alphabetically "lower" than it, the resulting combined file had jquery included after octopress.

The resulting file list from FileList on my machine (jquery comes last):

```irb
>> Rake::FileList.new('.themes/classic/source/javascripts/group/*')
=> [".themes/classic/source/javascripts/group/swfobject-dynamic.min.js", ".themes/classic/source/javascripts/group/pinboard.js", ".themes/classic/source/javascripts/group/octopress.js", ".themes/classic/source/javascripts/group/modernizr-2.0.min.js", ".themes/classic/source/javascripts/group/jquery.min.js"]
```

One solution is to have the rake task manually include jquery first, which I think is not maintainable.

The other is what this PR is doing: sorts (by name) the resulting array from FileList and gives a physical order to the files, using a similar scheme many Unix systems does when needing filename order