make sure compass sprites get built and copied. closes #228

This commit is contained in:
Thomas Reynolds 2012-01-06 00:01:24 -08:00
parent 92319ebffc
commit 3e1814e046
9 changed files with 19 additions and 2 deletions

View file

@ -22,8 +22,8 @@ require "middleman-core/vendor/hooks-0.2.0/lib/hooks"
module Middleman
WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) unless const_defined?(:WINDOWS)
JRUBY = !!(RbConfig::CONFIG["RUBY_INSTALL_NAME"] =~ /^jruby/i) unless const_defined?(:JRUBY)
DARWIN = RbConfig::CONFIG['target_os'] =~ /darwin/i
LINUX = RbConfig::CONFIG['target_os'] =~ /linux/i
DARWIN = RbConfig::CONFIG['target_os'] =~ /darwin/i unless const_defined?(:DARWIN)
LINUX = RbConfig::CONFIG['target_os'] =~ /linux/i unless const_defined?(:LINUX)
# Auto-load modules on-demand
autoload :Base, "middleman-core/base"

View file

@ -102,6 +102,7 @@ module Middleman::Cli
begin
destination, request_path = self.class.shared_instance.reroute_builder(destination, request_path)
# $stderr.puts request_path
response = self.class.shared_rack.get(request_path.gsub(/\s/, "%20"))
create_file(destination, response.body, config)
@ -189,6 +190,15 @@ module Middleman::Cli
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)
@app.sitemap.all_paths.select do |p|
File.extname(p) == ".css"
end.each do |p|
Middleman::Cli::Build.shared_rack.get("/" + p.gsub(/\s/, "%20"))
end
# Double-check for compass sprites
@app.files.reload_path(File.join(@app.source_dir, @app.images_dir))
# 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

View file

@ -0,0 +1,4 @@
Feature: Compass sprites should be generated on build and copied
Scenario: Building a clean site with sprites
Given a successfully built app at "compass-sprites-app"
Then the output should contain "images/icon-"

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

View file

@ -0,0 +1,3 @@
@import "compass";
@import "icon/*.png";
@include all-icon-sprites;