diff --git a/middleman-core/lib/middleman-core.rb b/middleman-core/lib/middleman-core.rb index 6666961b..8a145506 100755 --- a/middleman-core/lib/middleman-core.rb +++ b/middleman-core/lib/middleman-core.rb @@ -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" diff --git a/middleman-core/lib/middleman-core/cli/build.rb b/middleman-core/lib/middleman-core/cli/build.rb index 1cc766bc..d2b19b6a 100644 --- a/middleman-core/lib/middleman-core/cli/build.rb +++ b/middleman-core/lib/middleman-core/cli/build.rb @@ -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 diff --git a/middleman-more/features/compass-sprites.feature b/middleman-more/features/compass-sprites.feature new file mode 100644 index 00000000..e4c060a6 --- /dev/null +++ b/middleman-more/features/compass-sprites.feature @@ -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-" \ No newline at end of file diff --git a/middleman-more/fixtures/compass-sprites-app/config.rb b/middleman-more/fixtures/compass-sprites-app/config.rb new file mode 100644 index 00000000..e69de29b diff --git a/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_down.png b/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_down.png new file mode 100755 index 00000000..2c4e2793 Binary files /dev/null and b/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_down.png differ diff --git a/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_left.png b/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_left.png new file mode 100755 index 00000000..5dc69678 Binary files /dev/null and b/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_left.png differ diff --git a/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_right.png b/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_right.png new file mode 100755 index 00000000..b1a18192 Binary files /dev/null and b/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_right.png differ diff --git a/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_up.png b/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_up.png new file mode 100755 index 00000000..1ebb1932 Binary files /dev/null and b/middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_up.png differ diff --git a/middleman-more/fixtures/compass-sprites-app/source/stylesheets/site.css.scss b/middleman-more/fixtures/compass-sprites-app/source/stylesheets/site.css.scss new file mode 100644 index 00000000..25a6f535 --- /dev/null +++ b/middleman-more/fixtures/compass-sprites-app/source/stylesheets/site.css.scss @@ -0,0 +1,3 @@ +@import "compass"; +@import "icon/*.png"; +@include all-icon-sprites; \ No newline at end of file