avoid running Sass compilation twice
This commit is contained in:
parent
a40ef1a734
commit
fcbf9f1568
|
@ -185,9 +185,7 @@ module Middleman::Cli
|
||||||
|
|
||||||
@app.sitemap.resources.select do |resource|
|
@app.sitemap.resources.select do |resource|
|
||||||
resource.ext == '.css'
|
resource.ext == '.css'
|
||||||
end.each do |resource|
|
end.each(&method(:build_resource))
|
||||||
@rack.get(URI.escape(resource.destination_path))
|
|
||||||
end
|
|
||||||
|
|
||||||
logger.debug '== Checking for Compass sprites'
|
logger.debug '== Checking for Compass sprites'
|
||||||
|
|
||||||
|
@ -210,25 +208,29 @@ module Middleman::Cli
|
||||||
end
|
end
|
||||||
|
|
||||||
# Loop over all the paths and build them.
|
# Loop over all the paths and build them.
|
||||||
resources.each do |resource|
|
resources.reject do |resource|
|
||||||
next if @config[:glob] && !File.fnmatch(@config[:glob], resource.destination_path)
|
resource.ext == '.css'
|
||||||
|
end.each(&method(:build_resource))
|
||||||
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
|
|
||||||
|
|
||||||
::Middleman::Profiling.report('build')
|
::Middleman::Profiling.report('build')
|
||||||
end
|
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.
|
# Render a resource to a file.
|
||||||
#
|
#
|
||||||
# @param [Middleman::Sitemap::Resource] resource
|
# @param [Middleman::Sitemap::Resource] resource
|
||||||
|
|
Loading…
Reference in a new issue