From 3e1814e0467387756da6304de08a102df30871fe Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Fri, 6 Jan 2012 00:01:24 -0800 Subject: [PATCH] make sure compass sprites get built and copied. closes #228 --- middleman-core/lib/middleman-core.rb | 4 ++-- middleman-core/lib/middleman-core/cli/build.rb | 10 ++++++++++ middleman-more/features/compass-sprites.feature | 4 ++++ .../fixtures/compass-sprites-app/config.rb | 0 .../source/images/icon/arrow_down.png | Bin 0 -> 379 bytes .../source/images/icon/arrow_left.png | Bin 0 -> 345 bytes .../source/images/icon/arrow_right.png | Bin 0 -> 349 bytes .../source/images/icon/arrow_up.png | Bin 0 -> 372 bytes .../source/stylesheets/site.css.scss | 3 +++ 9 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 middleman-more/features/compass-sprites.feature create mode 100644 middleman-more/fixtures/compass-sprites-app/config.rb create mode 100755 middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_down.png create mode 100755 middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_left.png create mode 100755 middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_right.png create mode 100755 middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_up.png create mode 100644 middleman-more/fixtures/compass-sprites-app/source/stylesheets/site.css.scss 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 0000000000000000000000000000000000000000..2c4e279377bf348f9cf53894e76bb673ccf067bd GIT binary patch literal 379 zcmV->0fhdEP)RB*?~^j!LKVQ>(O&A{Xr%)RXLn#U zs4LtZ6rCMFY5|B2$)yG$6aaIFq$gGR5;6H z{Qv(y10{fofkH6I3@AO3$p*x`Nil#0jeqs;pT9Ds7{CaN1)$9r#n~kE{`~pF@bLXZ zhF?E_GyM7i!oL`P0x_8Wj$ni2F7#hzWPxfvDaIo>#A+qW*AYQLZl(!&BX$x7Ik;qO170ssEM z@$bKXf%rGW?|(r27bf-TSv zD}TdX0CM*JhkLO)8|Y^+n~Q^sK~hqR;q|N647YFGy>NTZJsWr!5CaSfwJm@a><8NX v2&h?|6w#wHUuW*nL5>vZR zlg{G&%mT~|kL3ei%GW0*UOHUMs5XI$4uxe-L?I@SAefq*207}Iqtjm#e5*fP53AiC z)C|RQfwzxx<#_WfANRGZx{+tFDl8~Q?;~Ve=lM^*8UTTnVL?HTDz8uta0D@d28E9S z_)i8aLz^UE6PPKymi;2GJ`34{eIia-CtfAt0H61rk0 SPTNud0000