tweaks and erb
This commit is contained in:
parent
25ce57017b
commit
071e65b921
|
@ -12,7 +12,9 @@ module Middleman
|
|||
end
|
||||
|
||||
autoload :Base, "middleman/base"
|
||||
autoload :ERb, "middleman/erb"
|
||||
autoload :Haml, "middleman/haml"
|
||||
autoload :Sass, "middleman/sass"
|
||||
autoload :Helpers, "middleman/helpers"
|
||||
|
||||
end
|
|
@ -126,6 +126,7 @@ module Middleman
|
|||
end
|
||||
end
|
||||
|
||||
require "middleman/erb"
|
||||
# Haml is required & includes helpers
|
||||
require "middleman/haml"
|
||||
require "middleman/sass"
|
||||
|
@ -144,6 +145,7 @@ class Middleman::Base
|
|||
disable :automatic_image_sizes
|
||||
disable :relative_assets
|
||||
disable :cache_buster
|
||||
disable :ugly_haml
|
||||
|
||||
# Default build features
|
||||
configure :build do
|
||||
|
|
24
lib/middleman/erb.rb
Executable file
24
lib/middleman/erb.rb
Executable file
|
@ -0,0 +1,24 @@
|
|||
require "erb"
|
||||
|
||||
module Middleman
|
||||
module ERb
|
||||
module Renderer
|
||||
def self.included(base)
|
||||
base.supported_formats << "erb"
|
||||
end
|
||||
|
||||
def render_path(path, layout)
|
||||
if template_exists?(path, :erb)
|
||||
layout = false if File.extname(path) == ".xml"
|
||||
erb(path.to_sym, :layout => layout)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Middleman::Base
|
||||
include Middleman::ERb::Renderer
|
||||
end
|
|
@ -13,7 +13,7 @@ module Middleman
|
|||
result = nil
|
||||
begin
|
||||
layout = false if File.extname(path) == ".xml"
|
||||
result = haml(path.to_sym, :layout => layout)
|
||||
result = haml(path.to_sym, :layout => layout, :ugly => Middleman::Base.enabled?(:ugly_haml))
|
||||
rescue ::Haml::Error => e
|
||||
result = "Haml Error: #{e}"
|
||||
result << "<pre>Backtrace: #{e.backtrace.join("\n")}</pre>"
|
||||
|
|
|
@ -9,7 +9,7 @@ rescue LoadError
|
|||
puts "YUI-Compressor not available. Install it with: gem install yui-compressor"
|
||||
end
|
||||
|
||||
module Middleman::Sass
|
||||
module Middleman::Sass
|
||||
def self.included(base)
|
||||
base.supported_formats << "sass"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue