class Middleman::Cli::GlobAction

def execute!

Returns:
  • (void) -
def execute!
  # Sort order, images, fonts, js/css and finally everything else.
  sort_order = %w(.png .jpeg .jpg .gif .bmp .svg .svgz .ico .woff .otf .ttf .eot .js .css)
  # Pre-request CSS to give Compass a chance to build sprites
  logger.debug "== Prerendering CSS"
  @app.sitemap.resources.select do |resource|
    resource.ext == ".css"
  end.each do |resource|
    Middleman::Cli::Build.shared_rack.get(URI.escape(resource.destination_path))
  end
  logger.debug "== Checking for Compass sprites"
  # Double-check for compass sprites
  @app.files.find_new_files((Pathname(@app.source_dir) + @app.images_dir).relative_path_from(@app.root_path))
  # Sort paths to be built by the above order. This is primarily so Compass can
  # find files in the build folder when it needs to generate sprites for the
  # css files
  logger.debug "== Building files"
  resources = @app.sitemap.resources.sort_by do |r|
    sort_order.index(r.ext) || 100
  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 = base.render_to_file(resource)
    if cleaning?
      pn = Pathname(output_path)
      @cleaning_queue.delete(pn.realpath) if pn.exist?
    end
  end
  ::Middleman::Profiling.report("build")
end