attempt some speedups

This commit is contained in:
Thomas Reynolds 2011-11-10 15:56:04 -08:00
parent 610509b373
commit ff2eddf5b8
12 changed files with 23 additions and 69 deletions

View file

@ -4,6 +4,7 @@ Finally support Compass in Sprockets! Thanks to @xdite and @petebrowne
Sitemap object representing the known world
FileWatcher proxies file change events
Unified callback solution
Removed Slim and Maruku from base install. Will need to be installed and required by the user (in config.rb)
2.0.14
====

View file

@ -1,3 +1,8 @@
require "maruku"
require "slim"
require "liquid"
require "coffee-filter"
page "/fake.html", :proxy => "/real.html", :layout => false
ignore "/should_be_ignored.html"

View file

@ -73,9 +73,7 @@ module Middleman
# Custom Renderers
module Renderers
autoload :Haml, "middleman/renderers/haml"
autoload :Sass, "middleman/renderers/sass"
autoload :Slim, "middleman/renderers/slim"
autoload :Markdown, "middleman/renderers/markdown"
autoload :ERb, "middleman/renderers/erb"
autoload :CoffeeScript, "middleman/renderers/coffee_script"

View file

@ -77,10 +77,10 @@ module Middleman::Base
# Parse YAML from templates
app.register Middleman::CoreExtensions::FrontMatter
app.set :default_features, [
:lorem,
:sitemap_tree
# :lorem,
# :sitemap_tree
]
# Default layout name

View file

@ -1,3 +1,5 @@
require "compass"
module Middleman::CoreExtensions::Compass
class << self
def registered(app)
@ -6,14 +8,6 @@ module Middleman::CoreExtensions::Compass
app.define_hook :compass_config
app.define_hook :after_compass_config
require "compass"
# Susy grids
begin
require "susy"
rescue LoadError
end
app.after_configuration do
# Support a stand-alone compass config file
# Many options are overwritten by Middleman, but the config is a good

View file

@ -7,8 +7,6 @@ module Middleman::CoreExtensions::Rendering
app.register Padrino::Rendering
# Activate custom renderers
app.register Middleman::Renderers::Slim
app.register Middleman::Renderers::Haml
app.register Middleman::Renderers::Sass
app.register Middleman::Renderers::Markdown
app.register Middleman::Renderers::ERb

View file

@ -15,7 +15,7 @@ module Middleman::Renderers::ERb
engine = app.settings.erb_engine
if engine.is_a? Symbol
engine = app.tilt_template_from_symbol(engine)
engine = app.erb_tilt_template_from_symbol(engine)
end
::Tilt.prefer(engine)
@ -25,7 +25,7 @@ module Middleman::Renderers::ERb
end
module ClassMethods
def tilt_template_from_symbol(engine)
def erb_tilt_template_from_symbol(engine)
engine = engine.to_s
engine = engine == "erb" ? "ERB" : engine.camelize
settings.erb_engine_prefix.const_get("#{engine}Template")

View file

@ -1,31 +0,0 @@
module Middleman::Renderers::Haml
class << self
def registered(app)
# Base library
require "haml"
# Coffee-script filter for Haml
begin
require "coffee-filter"
rescue LoadError
end
# Code-ray Syntax highlighting
begin
require 'haml-coderay'
rescue LoadError
end
app.helpers Helpers
#app.set :haml, app.settings.haml.merge({ :ugly_haml => true })
end
alias :included :registered
end
module Helpers
def haml_partial(name, options = {})
render(name, options)
end
end
end

View file

@ -16,7 +16,6 @@ module Middleman::Renderers::Liquid
if result && result[1] == :liquid
request['custom_locals'] ||= {}
request['custom_locals'][:data] = data.to_h
# request['custom_locals'].merge(data.to_h)
end
true

View file

@ -1,11 +1,9 @@
require "tilt"
module Middleman::Renderers::Markdown
class << self
def registered(app)
app.extend ClassMethods
app.set :markdown_engine, :maruku
app.set :markdown_engine, nil
if !app.respond_to? :markdown_engine_prefix
app.set :markdown_engine_prefix, ::Tilt
@ -14,18 +12,20 @@ module Middleman::Renderers::Markdown
app.after_configuration do
engine = app.settings.markdown_engine
if engine.is_a? Symbol
engine = app.tilt_template_from_symbol(engine)
end
unless engine.nil?
if engine.is_a? Symbol
engine = app.markdown_tilt_template_from_symbol(engine)
end
::Tilt.prefer(engine)
::Tilt.prefer(engine)
end
end
end
alias :included :registered
end
module ClassMethods
def tilt_template_from_symbol(engine)
def markdown_tilt_template_from_symbol(engine)
engine = engine.to_s
engine = engine == "rdiscount" ? "RDiscount" : engine.camelize
settings.markdown_engine_prefix.const_get("#{engine}Template")

View file

@ -1,8 +0,0 @@
module Middleman::Renderers::Slim
class << self
def registered(app)
require "slim"
end
alias :included :registered
end
end

View file

@ -24,7 +24,6 @@ Gem::Specification.new do |s|
s.add_dependency("thin", ["~> 1.2.11"])
s.add_dependency("thor", ["~> 0.14.0"])
s.add_dependency("tilt", ["~> 1.3.1"])
s.add_dependency("maruku", ["~> 0.6.0"])
s.add_dependency("sinatra", ["~> 1.3.1"])
s.add_dependency("rack-test", ["~> 0.6.1"])
s.add_dependency("uglifier", ["~> 1.0.0"])
@ -41,14 +40,13 @@ Gem::Specification.new do |s|
s.add_dependency("guard", ["~> 0.8.8"])
s.add_dependency("rb-fsevent")
s.add_dependency("rb-inotify")
# s.add_dependency("eventmachine", ["1.0.0.beta.4"])
# s.add_dependency("middleman-livereload", ["~> 0.2.0"])
# s.add_dependency("rb-inotify")
# Development and test
s.add_development_dependency("coffee-filter", ["~> 0.1.1"])
s.add_development_dependency("liquid", ["~> 2.2.0"])
s.add_development_dependency("slim", ["~> 1.0.2"])
s.add_development_dependency("maruku", ["~> 0.6.0"])
s.add_development_dependency("cucumber", ["~> 1.0.2"])
s.add_development_dependency("rake", ["~> 0.9.2"])
s.add_development_dependency("rspec", ["~> 2.6.0"])