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.
autoload :RelativeAssets, "middleman/features/relative_assets"
# AssetHost allows you to setup multiple domains to host your static assets.
# Calls to asset paths in dynamic templates will then rotate through each of
# the asset servers to better spread the load.
# AssetHost allows you to setup multiple domains to host your static
# assets. Calls to asset paths in dynamic templates will then rotate
# through each of the asset servers to better spread the load.
autoload :AssetHost, "middleman/features/asset_host"
# CacheBuster adds a query string to assets in dynamic templates to avoid
# browser caches failing to update to your new content.
autoload :CacheBuster, "middleman/features/cache_buster"
# AutomaticImageSizes inspects the images used in your dynamic templates and
# automatically adds width and height attributes to their HTML elements.
# AutomaticImageSizes inspects the images used in your dynamic templates
# and automatically adds width and height attributes to their HTML
# elements.
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
autoload :MinifyCss, "middleman/features/minify_css"
# MinifyJavascript uses the YUI compressor to shrink JS files
autoload :MinifyJavascript, "middleman/features/minify_javascript"
# CodeRay is a syntax highlighter.
autoload :CodeRay, "middleman/features/code_ray"
# Lorem provides a handful of helpful prototyping methods to generate 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"
# Treat project as a blog
@ -143,8 +137,8 @@ module Middleman
# Automatically resize images for mobile devises
# autoload :TinySrc, "middleman/features/tiny_src"
# LiveReload will auto-reload browsers with the live reload extension installed after changes
# Currently disabled and untested.
# LiveReload will auto-reload browsers with the live reload extension
# installed after changes. Currently disabled and untested.
# autoload :LiveReload, "middleman/features/live_reload"
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"
# 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

View file

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

View file

@ -1,7 +1,17 @@
# CodeRay syntax highlighting in Haml
# activate :code_ray
# Susy grids in Compass
# 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"
# activate :slickmap

View file

@ -8,8 +8,8 @@ Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.authors = ["Thomas Reynolds"]
s.email = ["tdreyno@gmail.com"]
s.homepage = "http://wiki.github.com/tdreyno/middleman"
s.summary = "A static site generator based on Sinatra. Providing Haml, Sass, Compass, Less, Coffee Script and including minification, compression and cache busting."
s.homepage = "http://middlemanapp.com"
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"
@ -29,11 +29,8 @@ Gem::Specification.new do |s|
s.add_runtime_dependency("uglifier", ["~> 0.5.0"])
s.add_runtime_dependency("slim", ["~> 0.9.4"])
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("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_development_dependency("spork", ["~> 0.9.0.rc8"])
s.add_development_dependency("cucumber", ["~> 0.10.0"])