Merge pull request #3204 from jekyll/sort-static-files-once
This commit is contained in:
		
						commit
						f81601ee53
					
				|  | @ -3,11 +3,12 @@ | |||
| module Jekyll | ||||
|   class Renderer | ||||
| 
 | ||||
|     attr_reader :document, :site | ||||
|     attr_reader :document, :site, :site_payload | ||||
| 
 | ||||
|     def initialize(site, document) | ||||
|       @site     = site | ||||
|       @document = document | ||||
|     def initialize(site, document, site_payload = nil) | ||||
|       @site         = site | ||||
|       @document     = document | ||||
|       @site_payload = site_payload | ||||
|     end | ||||
| 
 | ||||
|     # Determine which converters to use based on this document's | ||||
|  | @ -32,7 +33,7 @@ module Jekyll | |||
|     def run | ||||
|       payload = Utils.deep_merge_hashes({ | ||||
|         "page" => document.to_liquid | ||||
|       }, site.site_payload) | ||||
|       }, site_payload || site.site_payload) | ||||
| 
 | ||||
|       info = { | ||||
|         filters:   [Jekyll::Filters], | ||||
|  |  | |||
|  | @ -187,6 +187,7 @@ module Jekyll | |||
|       end | ||||
| 
 | ||||
|       pages.sort_by!(&:name) | ||||
|       static_files.sort_by!(&:relative_path) | ||||
|     end | ||||
| 
 | ||||
|     # Read all the files in <source>/<dir>/_posts and create a new Post | ||||
|  | @ -291,9 +292,10 @@ module Jekyll | |||
|     def render | ||||
|       relative_permalinks_deprecation_method | ||||
| 
 | ||||
|       payload = site_payload | ||||
|       collections.each do |label, collection| | ||||
|         collection.docs.each do |document| | ||||
|           document.output = Jekyll::Renderer.new(self, document).run if document.regenerate? | ||||
|           document.output = Jekyll::Renderer.new(self, document, payload).run if document.regenerate? | ||||
|         end | ||||
|       end | ||||
| 
 | ||||
|  | @ -384,7 +386,7 @@ module Jekyll | |||
|             "time"         => time, | ||||
|             "posts"        => posts.sort { |a, b| b <=> a }, | ||||
|             "pages"        => pages, | ||||
|             "static_files" => static_files.sort { |a, b| a.relative_path <=> b.relative_path }, | ||||
|             "static_files" => static_files, | ||||
|             "html_pages"   => pages.select { |page| page.html? || page.url.end_with?("/") }, | ||||
|             "categories"   => post_attr_hash('categories'), | ||||
|             "tags"         => post_attr_hash('tags'), | ||||
|  |  | |||
|  | @ -3,6 +3,8 @@ module Jekyll | |||
|     # The cache of last modification times [path] -> mtime. | ||||
|     @@mtimes = Hash.new | ||||
| 
 | ||||
|     attr_reader :relative_path | ||||
| 
 | ||||
|     # Initialize a new StaticFile. | ||||
|     # | ||||
|     # site - The Site. | ||||
|  | @ -15,6 +17,7 @@ module Jekyll | |||
|       @dir  = dir | ||||
|       @name = name | ||||
|       @collection = collection | ||||
|       @relative_path = File.join(*[@dir, @name].compact) | ||||
|     end | ||||
| 
 | ||||
|     # Returns source file path. | ||||
|  | @ -22,11 +25,6 @@ module Jekyll | |||
|       File.join(*[@base, @dir, @name].compact) | ||||
|     end | ||||
| 
 | ||||
|     # Returns the source file path relative to the site source | ||||
|     def relative_path | ||||
|       @relative_path ||= File.join(*[@dir, @name].compact) | ||||
|     end | ||||
| 
 | ||||
|     def extname | ||||
|       File.extname(path) | ||||
|     end | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue