enable less and builder support

This commit is contained in:
Thomas Reynolds 2010-08-06 09:59:38 -07:00
parent 2647c1da80
commit 8d2c070104
9 changed files with 80 additions and 25 deletions

View file

@ -21,6 +21,8 @@ begin
gem.add_dependency("sprockets") gem.add_dependency("sprockets")
gem.add_dependency("sinatra", ">=1.0") gem.add_dependency("sinatra", ">=1.0")
gem.add_dependency("sinatra-content-for") gem.add_dependency("sinatra-content-for")
gem.add_dependency("less")
gem.add_dependency("builder")
gem.add_dependency("rack-test") gem.add_dependency("rack-test")
gem.add_dependency("yui-compressor") gem.add_dependency("yui-compressor")
gem.add_dependency("haml", ">=3.0") gem.add_dependency("haml", ">=3.0")

View file

@ -11,10 +11,15 @@ module Middleman
autoload :MinifyCSS, "middleman/rack/minify_css" autoload :MinifyCSS, "middleman/rack/minify_css"
end end
module Renderers
autoload :ERb, "middleman/renderers/erb"
autoload :Builder, "middleman/renderers/builder"
autoload :Less, "middleman/renderers/less"
end
autoload :Base, "middleman/base" autoload :Base, "middleman/base"
autoload :ERb, "middleman/erb" autoload :Haml, "middleman/renderers/haml"
autoload :Haml, "middleman/haml" autoload :Sass, "middleman/renderers/sass"
autoload :Sass, "middleman/sass"
autoload :Helpers, "middleman/helpers" autoload :Helpers, "middleman/helpers"
end end

View file

@ -126,10 +126,11 @@ module Middleman
end end
end end
require "middleman/erb" require "middleman/renderers/erb"
# Haml is required & includes helpers require "middleman/renderers/haml"
require "middleman/haml" require "middleman/renderers/sass"
require "middleman/sass" require "middleman/renderers/less"
require "middleman/renderers/builder"
class Middleman::Base class Middleman::Base
helpers Middleman::Helpers helpers Middleman::Helpers

View file

@ -0,0 +1,23 @@
require "builder"
module Middleman
module Renderers
module Builder
def self.included(base)
base.supported_formats << "builder"
end
def render_path(path, layout)
if template_exists?(path, :builder)
builder(path.to_sym, :layout => layout)
else
super
end
end
end
end
end
class Middleman::Base
include Middleman::Renderers::Builder
end

View file

@ -1,8 +1,8 @@
require "erb" require "erb"
module Middleman module Middleman
module Renderers
module ERb module ERb
module Renderer
def self.included(base) def self.included(base)
base.supported_formats << "erb" base.supported_formats << "erb"
end end
@ -20,5 +20,5 @@ module Middleman
end end
class Middleman::Base class Middleman::Base
include Middleman::ERb::Renderer include Middleman::Renderers::ERb
end end

View file

@ -0,0 +1,23 @@
require "less"
module Middleman
module Renderers
module Less
def self.included(base)
base.supported_formats << "less"
end
def render_path(path, layout)
if template_exists?(path, :less)
less(path.to_sym)
else
super
end
end
end
end
end
class Middleman::Base
include Middleman::Renderers::Less
end

View file

@ -1,6 +1,6 @@
# Generated by jeweler # Generated by jeweler
# DO NOT EDIT THIS FILE # DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec` # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
Gem::Specification.new do |s| Gem::Specification.new do |s|
@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Thomas Reynolds"] s.authors = ["Thomas Reynolds"]
s.date = %q{2010-06-09} s.date = %q{2010-08-06}
s.email = %q{tdreyno@gmail.com} s.email = %q{tdreyno@gmail.com}
s.executables = ["mm-init", "mm-build", "mm-server"] s.executables = ["mm-init", "mm-build", "mm-server"]
s.extra_rdoc_files = [ s.extra_rdoc_files = [
@ -99,23 +99,23 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"] s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"] s.require_paths = ["lib"]
s.rubyforge_project = %q{middleman} s.rubyforge_project = %q{middleman}
s.rubygems_version = %q{1.3.7} s.rubygems_version = %q{1.3.6}
s.summary = %q{A static site generator utilizing Haml, Sass and providing YUI compression and cache busting} s.summary = %q{A static site generator utilizing Haml, Sass and providing YUI compression and cache busting}
s.test_files = [ s.test_files = [
"spec/spec_helper.rb",
"spec/builder_spec.rb", "spec/builder_spec.rb",
"spec/fixtures/sample/init.rb",
"spec/helpers_spec.rb", "spec/helpers_spec.rb",
"spec/spec_helper.rb" "spec/fixtures/sample/init.rb"
] ]
if s.respond_to? :specification_version then if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3 s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<rack>, [">= 0"]) s.add_runtime_dependency(%q<rack>, [">= 0"])
s.add_runtime_dependency(%q<thin>, [">= 0"]) s.add_runtime_dependency(%q<thin>, [">= 0"])
s.add_runtime_dependency(%q<shotgun>, [">= 0"]) s.add_runtime_dependency(%q<shotgun>, [">= 0.8"])
s.add_runtime_dependency(%q<templater>, [">= 0"]) s.add_runtime_dependency(%q<templater>, [">= 0"])
s.add_runtime_dependency(%q<sprockets>, [">= 0"]) s.add_runtime_dependency(%q<sprockets>, [">= 0"])
s.add_runtime_dependency(%q<sinatra>, [">= 1.0"]) s.add_runtime_dependency(%q<sinatra>, [">= 1.0"])
@ -134,7 +134,7 @@ Gem::Specification.new do |s|
else else
s.add_dependency(%q<rack>, [">= 0"]) s.add_dependency(%q<rack>, [">= 0"])
s.add_dependency(%q<thin>, [">= 0"]) s.add_dependency(%q<thin>, [">= 0"])
s.add_dependency(%q<shotgun>, [">= 0"]) s.add_dependency(%q<shotgun>, [">= 0.8"])
s.add_dependency(%q<templater>, [">= 0"]) s.add_dependency(%q<templater>, [">= 0"])
s.add_dependency(%q<sprockets>, [">= 0"]) s.add_dependency(%q<sprockets>, [">= 0"])
s.add_dependency(%q<sinatra>, [">= 1.0"]) s.add_dependency(%q<sinatra>, [">= 1.0"])
@ -154,7 +154,7 @@ Gem::Specification.new do |s|
else else
s.add_dependency(%q<rack>, [">= 0"]) s.add_dependency(%q<rack>, [">= 0"])
s.add_dependency(%q<thin>, [">= 0"]) s.add_dependency(%q<thin>, [">= 0"])
s.add_dependency(%q<shotgun>, [">= 0"]) s.add_dependency(%q<shotgun>, [">= 0.8"])
s.add_dependency(%q<templater>, [">= 0"]) s.add_dependency(%q<templater>, [">= 0"])
s.add_dependency(%q<sprockets>, [">= 0"]) s.add_dependency(%q<sprockets>, [">= 0"])
s.add_dependency(%q<sinatra>, [">= 1.0"]) s.add_dependency(%q<sinatra>, [">= 1.0"])
@ -172,3 +172,4 @@ Gem::Specification.new do |s|
s.add_dependency(%q<jeweler>, [">= 0"]) s.add_dependency(%q<jeweler>, [">= 0"])
end end
end end