Add back compass sprite prerender step

feature/livereload-locales-data
Thomas Reynolds 2015-12-13 14:30:10 -08:00
parent defa6daa6d
commit 4122bd7351
1 changed files with 17 additions and 0 deletions

View File

@ -55,6 +55,7 @@ module Middleman
queue_current_paths if @cleaning
prerender_css
output_files
clean if @cleaning
@ -66,6 +67,21 @@ module Middleman
!@has_error
end
# Pre-request CSS to give Compass a chance to build sprites
# @return [Array<Resource>] List of css resources that were output.
Contract ResourceList
def prerender_css
logger.debug '== Prerendering CSS'
css_files = @app.sitemap.resources.select do |resource|
resource.ext == '.css'
end.each(&method(:output_resource))
logger.debug '== Checking for Compass sprites'
# Double-check for compass sprites
@app.files.find_new_files!
@app.sitemap.ensure_resource_list_updated!
css_files
end
# Find all the files we need to output and do so.
# @return [Array<Resource>] List of resources that were output.
Contract ResourceList
@ -74,6 +90,7 @@ module Middleman
@app.sitemap.resources
.sort_by { |resource| SORT_ORDER.index(resource.ext) || 100 }
.reject { |resource| resource.ext == '.css' }
.select { |resource| !@glob || File.fnmatch(@glob, resource.destination_path) }
.each(&method(:output_resource))
end