Really fix #1689
This commit is contained in:
parent
6af784d5d5
commit
9e5b137ed8
|
@ -64,7 +64,7 @@ module Middleman::Cli
|
|||
|
||||
if builder.run!
|
||||
clean_directories! if options['clean']
|
||||
shell.say "Project built successfully."
|
||||
shell.say 'Project built successfully.'
|
||||
else
|
||||
msg = 'There were errors during this build'
|
||||
unless options['verbose']
|
||||
|
|
|
@ -41,6 +41,11 @@ Feature: Relative Assets
|
|||
And I should see 'url(../fonts/roboto/roboto-regular-webfont.woff'
|
||||
And I should see 'url(../fonts/roboto/roboto-regular-webfont.ttf'
|
||||
And I should see 'url(../fonts/roboto/roboto-regular-webfont.svg'
|
||||
When I go to "/stylesheets/fonts2.css"
|
||||
Then I should see 'url(../fonts/roboto/roboto-regular-webfont.eot'
|
||||
And I should see 'url(../fonts/roboto/roboto-regular-webfont.woff'
|
||||
And I should see 'url(../fonts/roboto/roboto-regular-webfont.ttf'
|
||||
And I should see 'url(../fonts/roboto/roboto-regular-webfont.svg'
|
||||
|
||||
Scenario: Building css with the feature enabled
|
||||
Given a fixture app "relative-assets-app"
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url(/fonts/roboto/roboto-regular-webfont.eot);
|
||||
src: url(/fonts/roboto/roboto-regular-webfont.eot?#iefix) format('embedded-opentype'),
|
||||
url(/fonts/roboto/roboto-regular-webfont.woff) format('woff'),
|
||||
url(/fonts/roboto/roboto-regular-webfont.ttf) format('truetype'),
|
||||
url(/fonts/roboto/roboto-regular-webfont.svg#robotoregular) format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
|
@ -332,12 +332,19 @@ module Middleman
|
|||
|
||||
Contract String, String, ArrayOf[String], Proc => String
|
||||
def rewrite_paths(body, _path, exts, &_block)
|
||||
matcher = /([=\'\"\(,] *)([^\s\'\"\)>]+(#{Regexp.union(exts)}))/
|
||||
matcher = /([=\'\"\(,]\s*)([^\s\'\"\)>]+(#{Regexp.union(exts)}))/
|
||||
|
||||
url_fn_prefix = 'url('
|
||||
|
||||
body.dup.gsub(matcher) do |match|
|
||||
opening_character = $1
|
||||
asset_path = $2
|
||||
|
||||
if asset_path.start_with?(url_fn_prefix)
|
||||
opening_character << url_fn_prefix
|
||||
asset_path = asset_path[url_fn_prefix.length..-1]
|
||||
end
|
||||
|
||||
begin
|
||||
uri = ::Addressable::URI.parse(asset_path)
|
||||
|
||||
|
|
Loading…
Reference in a new issue