avoid running Sass compilation twice

This commit is contained in:
Thomas Reynolds 2014-04-07 09:38:00 -07:00
parent a40ef1a734
commit fcbf9f1568

View file

@ -185,9 +185,7 @@ module Middleman::Cli
@app.sitemap.resources.select do |resource|
resource.ext == '.css'
end.each do |resource|
@rack.get(URI.escape(resource.destination_path))
end
end.each(&method(:build_resource))
logger.debug '== Checking for Compass sprites'
@ -210,25 +208,29 @@ module Middleman::Cli
end
# Loop over all the paths and build them.
resources.each do |resource|
next if @config[:glob] && !File.fnmatch(@config[:glob], resource.destination_path)
output_path = render_to_file(resource)
if should_clean? && output_path.exist?
if RUBY_PLATFORM =~ /darwin/
# handle UTF-8-MAC filename on MacOS
@to_clean.delete(output_path.realpath.to_s.encode('UTF-8', 'UTF-8-MAC'))
else
@to_clean.delete(output_path.realpath)
end
end
end
resources.reject do |resource|
resource.ext == '.css'
end.each(&method(:build_resource))
::Middleman::Profiling.report('build')
end
def build_resource(resource)
return if @config[:glob] && !File.fnmatch(@config[:glob], resource.destination_path)
output_path = render_to_file(resource)
if should_clean? && output_path.exist?
if RUBY_PLATFORM =~ /darwin/
# handle UTF-8-MAC filename on MacOS
@to_clean.delete(output_path.realpath.to_s.encode('UTF-8', 'UTF-8-MAC'))
else
@to_clean.delete(output_path.realpath)
end
end
end
# Render a resource to a file.
#
# @param [Middleman::Sitemap::Resource] resource