make sure compass sprites get built and copied. closes #228
This commit is contained in:
parent
92319ebffc
commit
3e1814e046
9 changed files with 19 additions and 2 deletions
|
@ -22,8 +22,8 @@ require "middleman-core/vendor/hooks-0.2.0/lib/hooks"
|
||||||
module Middleman
|
module Middleman
|
||||||
WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) unless const_defined?(:WINDOWS)
|
WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) unless const_defined?(:WINDOWS)
|
||||||
JRUBY = !!(RbConfig::CONFIG["RUBY_INSTALL_NAME"] =~ /^jruby/i) unless const_defined?(:JRUBY)
|
JRUBY = !!(RbConfig::CONFIG["RUBY_INSTALL_NAME"] =~ /^jruby/i) unless const_defined?(:JRUBY)
|
||||||
DARWIN = RbConfig::CONFIG['target_os'] =~ /darwin/i
|
DARWIN = RbConfig::CONFIG['target_os'] =~ /darwin/i unless const_defined?(:DARWIN)
|
||||||
LINUX = RbConfig::CONFIG['target_os'] =~ /linux/i
|
LINUX = RbConfig::CONFIG['target_os'] =~ /linux/i unless const_defined?(:LINUX)
|
||||||
|
|
||||||
# Auto-load modules on-demand
|
# Auto-load modules on-demand
|
||||||
autoload :Base, "middleman-core/base"
|
autoload :Base, "middleman-core/base"
|
||||||
|
|
|
@ -102,6 +102,7 @@ module Middleman::Cli
|
||||||
begin
|
begin
|
||||||
destination, request_path = self.class.shared_instance.reroute_builder(destination, request_path)
|
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"))
|
response = self.class.shared_rack.get(request_path.gsub(/\s/, "%20"))
|
||||||
|
|
||||||
create_file(destination, response.body, config)
|
create_file(destination, response.body, config)
|
||||||
|
@ -189,6 +190,15 @@ module Middleman::Cli
|
||||||
def execute!
|
def execute!
|
||||||
# Sort order, images, fonts, js/css and finally everything else.
|
# 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)
|
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
|
# 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
|
# find files in the build folder when it needs to generate sprites for the
|
||||||
|
|
4
middleman-more/features/compass-sprites.feature
Normal file
4
middleman-more/features/compass-sprites.feature
Normal 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-"
|
0
middleman-more/fixtures/compass-sprites-app/config.rb
Normal file
0
middleman-more/fixtures/compass-sprites-app/config.rb
Normal file
BIN
middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_down.png
Executable file
BIN
middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_down.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 379 B |
BIN
middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_left.png
Executable file
BIN
middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_left.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 345 B |
BIN
middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_right.png
Executable file
BIN
middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_right.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 349 B |
BIN
middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_up.png
Executable file
BIN
middleman-more/fixtures/compass-sprites-app/source/images/icon/arrow_up.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 372 B |
|
@ -0,0 +1,3 @@
|
||||||
|
@import "compass";
|
||||||
|
@import "icon/*.png";
|
||||||
|
@include all-icon-sprites;
|
Loading…
Reference in a new issue