From e0166682da368817aedf37ca9d62aca5bc8a10a5 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 19 Feb 2014 14:02:03 -0500 Subject: [PATCH] Sort the static files by relative path before sending to liquid --- lib/jekyll/site.rb | 2 +- lib/jekyll/static_file.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index ce48366d..b39041e6 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -310,7 +310,7 @@ module Jekyll "time" => self.time, "posts" => self.posts.sort { |a, b| b <=> a }, "pages" => self.pages, - "static_files" => self.static_files, + "static_files" => self.static_files.sort { |a, b| a.relative_path <=> b.relative_path }, "html_pages" => self.pages.reject { |page| !page.html? }, "categories" => post_attr_hash('categories'), "tags" => post_attr_hash('tags'), diff --git a/lib/jekyll/static_file.rb b/lib/jekyll/static_file.rb index f7c243ff..dba66739 100644 --- a/lib/jekyll/static_file.rb +++ b/lib/jekyll/static_file.rb @@ -23,7 +23,7 @@ module Jekyll # Returns the source file path relative to the site source def relative_path - path.sub(/\A#{@site.source}/, '') + @relative_path ||= path.sub(/\A#{@site.source}/, '') end # Obtain destination path.