Add :relative_assets to default config.rb, allow overriding with --relative from mm-build command
This commit is contained in:
parent
7b666cb7c2
commit
856d1398c2
|
@ -14,3 +14,8 @@ Feature: Builder
|
||||||
Then "stylesheets/static.css" should exist and include "body"
|
Then "stylesheets/static.css" should exist and include "body"
|
||||||
Then "_partial.html" should not exist
|
Then "_partial.html" should not exist
|
||||||
And cleanup built test app
|
And cleanup built test app
|
||||||
|
|
||||||
|
Scenario: Force relative assets
|
||||||
|
Given a built test app with flags "--relative"
|
||||||
|
Then "stylesheets/site.css" should exist and include "../"
|
||||||
|
And cleanup built test app
|
|
@ -6,6 +6,12 @@ Given /^a built test app$/ do
|
||||||
`cd #{target} && MM_DIR="#{target}" #{build_cmd}`
|
`cd #{target} && MM_DIR="#{target}" #{build_cmd}`
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Given /^a built test app with flags "([^"]*)"$/ do |flags|
|
||||||
|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
||||||
|
build_cmd = File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "bin", "mm-build"))
|
||||||
|
`cd #{target} && MM_DIR="#{target}" #{build_cmd} #{flags}`
|
||||||
|
end
|
||||||
|
|
||||||
Given /^cleanup built test app$/ do
|
Given /^cleanup built test app$/ do
|
||||||
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build")
|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build")
|
||||||
FileUtils.rm_rf(target)
|
FileUtils.rm_rf(target)
|
||||||
|
|
|
@ -27,9 +27,15 @@ module Middleman
|
||||||
include Thor::Actions
|
include Thor::Actions
|
||||||
include Middleman::ThorActions
|
include Middleman::ThorActions
|
||||||
|
|
||||||
|
class_option :relative, :type => :boolean, :aliases => "-r", :default => false, :desc => 'Override the config.rb file and force relative urls'
|
||||||
|
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
Middleman::Server.new
|
|
||||||
super
|
super
|
||||||
|
|
||||||
|
Middleman::Server.new
|
||||||
|
if options.has_key?("relative") && options["relative"]
|
||||||
|
Middleman::Server.activate :relative_assets
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_paths
|
def source_paths
|
||||||
|
|
|
@ -52,10 +52,12 @@ configure :build do
|
||||||
# Enable cache buster
|
# Enable cache buster
|
||||||
# activate :cache_buster
|
# activate :cache_buster
|
||||||
|
|
||||||
|
# Use relative URLs
|
||||||
|
# activate :relative_assets
|
||||||
|
|
||||||
# Generate ugly/obfuscated HTML from Haml
|
# Generate ugly/obfuscated HTML from Haml
|
||||||
# activate :ugly_haml
|
# activate :ugly_haml
|
||||||
|
|
||||||
|
|
||||||
# Or use a different image path
|
# Or use a different image path
|
||||||
# set :http_path, "/Content/images/"
|
# set :http_path, "/Content/images/"
|
||||||
end
|
end
|
|
@ -40,6 +40,9 @@ configure :build do
|
||||||
# Enable cache buster
|
# Enable cache buster
|
||||||
# activate :cache_buster
|
# activate :cache_buster
|
||||||
|
|
||||||
|
# Use relative URLs
|
||||||
|
# activate :relative_assets
|
||||||
|
|
||||||
# Generate ugly/obfuscated HTML from Haml
|
# Generate ugly/obfuscated HTML from Haml
|
||||||
# activate :ugly_haml
|
# activate :ugly_haml
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module Middleman
|
module Middleman
|
||||||
VERSION = "1.1.2"
|
VERSION = "1.1.3"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue