make some deps dynamically loaded

This commit is contained in:
Thomas Reynolds 2011-07-10 13:55:40 -07:00
parent 22f3f0bc8c
commit f99b9fb2ca
7 changed files with 97 additions and 104 deletions

View file

@ -101,34 +101,28 @@ module Middleman
# relative to the root of the project or use an absolute URL. # relative to the root of the project or use an absolute URL.
autoload :RelativeAssets, "middleman/features/relative_assets" autoload :RelativeAssets, "middleman/features/relative_assets"
# AssetHost allows you to setup multiple domains to host your static assets. # AssetHost allows you to setup multiple domains to host your static
# Calls to asset paths in dynamic templates will then rotate through each of # assets. Calls to asset paths in dynamic templates will then rotate
# the asset servers to better spread the load. # through each of the asset servers to better spread the load.
autoload :AssetHost, "middleman/features/asset_host" autoload :AssetHost, "middleman/features/asset_host"
# CacheBuster adds a query string to assets in dynamic templates to avoid # CacheBuster adds a query string to assets in dynamic templates to avoid
# browser caches failing to update to your new content. # browser caches failing to update to your new content.
autoload :CacheBuster, "middleman/features/cache_buster" autoload :CacheBuster, "middleman/features/cache_buster"
# AutomaticImageSizes inspects the images used in your dynamic templates and # AutomaticImageSizes inspects the images used in your dynamic templates
# automatically adds width and height attributes to their HTML elements. # and automatically adds width and height attributes to their HTML
# elements.
autoload :AutomaticImageSizes, "middleman/features/automatic_image_sizes" autoload :AutomaticImageSizes, "middleman/features/automatic_image_sizes"
# UglyHaml enables the non-indented output format from Haml templates. Useful
# for somewhat obfuscating the output and hiding the fact that you're using Haml.
autoload :UglyHaml, "middleman/features/ugly_haml"
# MinifyCss uses the YUI compressor to shrink CSS files # MinifyCss uses the YUI compressor to shrink CSS files
autoload :MinifyCss, "middleman/features/minify_css" autoload :MinifyCss, "middleman/features/minify_css"
# MinifyJavascript uses the YUI compressor to shrink JS files # MinifyJavascript uses the YUI compressor to shrink JS files
autoload :MinifyJavascript, "middleman/features/minify_javascript" autoload :MinifyJavascript, "middleman/features/minify_javascript"
# CodeRay is a syntax highlighter. # Lorem provides a handful of helpful prototyping methods to generate
autoload :CodeRay, "middleman/features/code_ray" # words, paragraphs, fake images, names and email addresses.
# Lorem provides a handful of helpful prototyping methods to generate words,
# paragraphs, fake images, names and email addresses.
autoload :Lorem, "middleman/features/lorem" autoload :Lorem, "middleman/features/lorem"
# Treat project as a blog # Treat project as a blog
@ -143,8 +137,8 @@ module Middleman
# Automatically resize images for mobile devises # Automatically resize images for mobile devises
# autoload :TinySrc, "middleman/features/tiny_src" # autoload :TinySrc, "middleman/features/tiny_src"
# LiveReload will auto-reload browsers with the live reload extension installed after changes # LiveReload will auto-reload browsers with the live reload extension
# Currently disabled and untested. # installed after changes. Currently disabled and untested.
# autoload :LiveReload, "middleman/features/live_reload" # autoload :LiveReload, "middleman/features/live_reload"
end end
end end

View file

@ -1,12 +0,0 @@
module Middleman::Features::CodeRay
class << self
def registered(app)
begin
require 'haml-coderay'
rescue LoadError
puts "CodeRay not available. Install it with: gem install haml-coderay"
end
end
alias :included :registered
end
end

View file

@ -1,8 +0,0 @@
module Middleman::Features::UglyHaml
class << self
def registered(app)
app.set :haml, app.settings.haml.merge({ :ugly_haml => true })
end
alias :included :registered
end
end

View file

@ -5,9 +5,20 @@ module Middleman::Renderers::Haml
require "haml" require "haml"
# Coffee-script filter for Haml # Coffee-script filter for Haml
begin
require "coffee-filter" require "coffee-filter"
rescue LoadError
end
# Code-ray Syntax highlighting
begin
require 'haml-coderay'
rescue LoadError
end
app.helpers Helpers app.helpers Helpers
#app.set :haml, app.settings.haml.merge({ :ugly_haml => true })
end end
alias :included :registered alias :included :registered
end end

View file

@ -1,13 +1,16 @@
require "sass" require "sass"
require "sass/plugin" require "sass/plugin"
require "compass" require "compass"
require "susy"
module Middleman module Middleman::Renderers::Sass
module Renderers
module Sass
class << self class << self
def registered(app) def registered(app)
# Susy grids
begin
require "susy"
rescue LoadError
end
app.after_feature_init do app.after_feature_init do
views_root = File.basename(app.views) views_root = File.basename(app.views)
::Compass.configuration do |config| ::Compass.configuration do |config|
@ -70,8 +73,6 @@ module Middleman
::Tilt.register 'scss', ScssPlusCSSFilenameTemplate ::Tilt.register 'scss', ScssPlusCSSFilenameTemplate
::Tilt.prefer(ScssPlusCSSFilenameTemplate) ::Tilt.prefer(ScssPlusCSSFilenameTemplate)
end end
end
end
# Use compass settings in Haml filters # Use compass settings in Haml filters
# Other, tilt-based filters (like those used in Slim) will # Other, tilt-based filters (like those used in Slim) will

View file

@ -1,7 +1,17 @@
# CodeRay syntax highlighting in Haml # Susy grids in Compass
# activate :code_ray # First: gem install compass-susy-plugin
# require 'susy'
# Automatic sitemaps (gem install middleman-slickmap) # CodeRay syntax highlighting in Haml
# First: gem install haml-coderay
# require 'haml-coderay'
# CoffeeScript filters in Haml
# First: gem install coffee-filter
# require 'coffee-filter'
# Automatic sitemaps
# First: gem install middleman-slickmap
# require "middleman-slickmap" # require "middleman-slickmap"
# activate :slickmap # activate :slickmap

View file

@ -8,8 +8,8 @@ Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY s.platform = Gem::Platform::RUBY
s.authors = ["Thomas Reynolds"] s.authors = ["Thomas Reynolds"]
s.email = ["tdreyno@gmail.com"] s.email = ["tdreyno@gmail.com"]
s.homepage = "http://wiki.github.com/tdreyno/middleman" s.homepage = "http://middlemanapp.com"
s.summary = "A static site generator based on Sinatra. Providing Haml, Sass, Compass, Less, Coffee Script and including minification, compression and cache busting." s.summary = "A static site generator based on Sinatra. Providing Haml, Sass, Compass, CoffeeScript and including minification, compression and cache busting."
s.rubyforge_project = "middleman" s.rubyforge_project = "middleman"
@ -29,11 +29,8 @@ Gem::Specification.new do |s|
s.add_runtime_dependency("uglifier", ["~> 0.5.0"]) s.add_runtime_dependency("uglifier", ["~> 0.5.0"])
s.add_runtime_dependency("slim", ["~> 0.9.4"]) s.add_runtime_dependency("slim", ["~> 0.9.4"])
s.add_runtime_dependency("haml", ["~> 3.1.0"]) s.add_runtime_dependency("haml", ["~> 3.1.0"])
s.add_runtime_dependency("coffee-filter", ["~> 0.1.0"])
s.add_runtime_dependency("sass", ["~> 3.1.0"]) s.add_runtime_dependency("sass", ["~> 3.1.0"])
s.add_runtime_dependency("compass", ["~> 0.11.3"]) s.add_runtime_dependency("compass", ["~> 0.11.3"])
s.add_runtime_dependency("compass-susy-plugin", ["~> 0.9.0"])
s.add_runtime_dependency("coffee-script", ["~> 2.2.0"])
s.add_runtime_dependency("httparty", ["~> 0.7.0"]) s.add_runtime_dependency("httparty", ["~> 0.7.0"])
s.add_development_dependency("spork", ["~> 0.9.0.rc8"]) s.add_development_dependency("spork", ["~> 0.9.0.rc8"])
s.add_development_dependency("cucumber", ["~> 0.10.0"]) s.add_development_dependency("cucumber", ["~> 0.10.0"])