mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
tweaks and erb
This commit is contained in:
parent
25ce57017b
commit
071e65b921
5 changed files with 30 additions and 2 deletions
|
@ -12,7 +12,9 @@ module Middleman
|
||||||
end
|
end
|
||||||
|
|
||||||
autoload :Base, "middleman/base"
|
autoload :Base, "middleman/base"
|
||||||
|
autoload :ERb, "middleman/erb"
|
||||||
autoload :Haml, "middleman/haml"
|
autoload :Haml, "middleman/haml"
|
||||||
|
autoload :Sass, "middleman/sass"
|
||||||
autoload :Helpers, "middleman/helpers"
|
autoload :Helpers, "middleman/helpers"
|
||||||
|
|
||||||
end
|
end
|
|
@ -126,6 +126,7 @@ module Middleman
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require "middleman/erb"
|
||||||
# Haml is required & includes helpers
|
# Haml is required & includes helpers
|
||||||
require "middleman/haml"
|
require "middleman/haml"
|
||||||
require "middleman/sass"
|
require "middleman/sass"
|
||||||
|
@ -144,6 +145,7 @@ class Middleman::Base
|
||||||
disable :automatic_image_sizes
|
disable :automatic_image_sizes
|
||||||
disable :relative_assets
|
disable :relative_assets
|
||||||
disable :cache_buster
|
disable :cache_buster
|
||||||
|
disable :ugly_haml
|
||||||
|
|
||||||
# Default build features
|
# Default build features
|
||||||
configure :build do
|
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
|
result = nil
|
||||||
begin
|
begin
|
||||||
layout = false if File.extname(path) == ".xml"
|
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
|
rescue ::Haml::Error => e
|
||||||
result = "Haml Error: #{e}"
|
result = "Haml Error: #{e}"
|
||||||
result << "<pre>Backtrace: #{e.backtrace.join("\n")}</pre>"
|
result << "<pre>Backtrace: #{e.backtrace.join("\n")}</pre>"
|
||||||
|
|
Loading…
Add table
Reference in a new issue