Cleanup middleman-more loading, remove autoload

This commit is contained in:
Thomas Reynolds 2012-04-26 15:37:44 -07:00
parent 10922b6e34
commit d6f75afb3d
3 changed files with 82 additions and 75 deletions

View file

@ -3,77 +3,4 @@ libdir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
require "middleman-core" require "middleman-core"
require "middleman-more/register_extensions"
# Top-level Middleman object
module Middleman
# Custom Renderers
module Renderers
autoload :Haml, "middleman-more/renderers/haml"
autoload :Sass, "middleman-more/renderers/sass"
autoload :Markdown, "middleman-more/renderers/markdown"
autoload :Liquid, "middleman-more/renderers/liquid"
autoload :Slim, "middleman-more/renderers/slim"
end
# Core (automatic) extensions
module CoreExtensions
# Compass framework for Sass
autoload :Compass, "middleman-more/core_extensions/compass"
# Sprockets 2
autoload :Sprockets, "middleman-more/core_extensions/sprockets"
end
# User-activatable extensions
module Extensions
# RelativeAssets allow any asset path in dynamic templates to be either
# relative to the root of the project or use an absolute URL.
autoload :RelativeAssets, "middleman-more/extensions/relative_assets"
# CacheBuster adds a query string to assets in dynamic templates to avoid
# browser caches failing to update to your new content.
autoload :CacheBuster, "middleman-more/extensions/cache_buster"
# AssetHash appends a hash of the file contents to the assets filename
# to avoid browser caches failing to update to your new content.
autoload :AssetHash, "middleman-more/extensions/asset_hash"
# MinifyCss uses the YUI compressor to shrink CSS files
autoload :MinifyCss, "middleman-more/extensions/minify_css"
# MinifyJavascript uses the YUI compressor to shrink JS files
autoload :MinifyJavascript, "middleman-more/extensions/minify_javascript"
# GZIP assets and pages during build
autoload :Gzip, "middleman-more/extensions/gzip"
end
# Setup renderers
require "coffee_script"
Application.register Middleman::Renderers::Haml
Application.register Middleman::Renderers::Sass
Application.register Middleman::Renderers::Markdown
Application.register Middleman::Renderers::Liquid
Application.register Middleman::Renderers::Slim
# Compass framework
Application.register Middleman::CoreExtensions::Compass
# Sprockets asset handling
Application.register Middleman::CoreExtensions::Sprockets
# Register the optional extensions
Extensions.register(:cache_buster) {
::Middleman::Extensions::CacheBuster }
Extensions.register(:minify_css) {
::Middleman::Extensions::MinifyCss }
Extensions.register(:minify_javascript) {
::Middleman::Extensions::MinifyJavascript }
Extensions.register(:relative_assets) {
::Middleman::Extensions::RelativeAssets }
Extensions.register(:gzip) {
::Middleman::Extensions::Gzip }
Extensions.register(:asset_hash) {
::Middleman::Extensions::AssetHash }
end

View file

@ -0,0 +1,81 @@
###
# Setup renderers
###
# CoffeeScript Support
require "coffee_script"
# Haml Support
require "middleman-more/renderers/haml"
Middleman::Application.register Middleman::Renderers::Haml
# Sass Support
require "middleman-more/renderers/sass"
Middleman::Application.register Middleman::Renderers::Sass
# Markdown Support
require "middleman-more/renderers/markdown"
Middleman::Application.register Middleman::Renderers::Markdown
# Liquid Support
require "middleman-more/renderers/liquid"
Middleman::Application.register Middleman::Renderers::Liquid
# Slim Support
require "middleman-more/renderers/slim"
Middleman::Application.register Middleman::Renderers::Slim
###
# Setup Core Extensions
###
# Compass framework
require "middleman-more/core_extensions/compass"
Middleman::Application.register Middleman::CoreExtensions::Compass
# Sprockets asset handling
require "middleman-more/core_extensions/sprockets"
Middleman::Application.register Middleman::CoreExtensions::Sprockets
###
# Setup Optional Extensions
###
# CacheBuster adds a query string to assets in dynamic templates to avoid
# browser caches failing to update to your new content.
Middleman::Extensions.register(:cache_buster) do
require "middleman-more/extensions/cache_buster"
Middleman::Extensions::CacheBuster
end
# MinifyCss compresses CSS
Middleman::Extensions.register(:minify_css) do
require "middleman-more/extensions/minify_css"
Middleman::Extensions::MinifyCss
end
# MinifyJavascript compresses JS
Middleman::Extensions.register(:minify_javascript) do
require "middleman-more/extensions/minify_javascript"
Middleman::Extensions::MinifyJavascript
end
# RelativeAssets allow any asset path in dynamic templates to be either
# relative to the root of the project or use an absolute URL.
Middleman::Extensions.register(:relative_assets) do
require "middleman-more/extensions/relative_assets"
Middleman::Extensions::RelativeAssets
end
# GZIP assets and pages during build
Middleman::Extensions.register(:gzip) do
require "middleman-more/extensions/gzip"
Middleman::Extensions::Gzip
end
# AssetHash appends a hash of the file contents to the assets filename
# to avoid browser caches failing to update to your new content.
Middleman::Extensions.register(:asset_hash) do
require "middleman-more/extensions/asset_hash"
Middleman::Extensions::AssetHash
end

View file

@ -15,7 +15,6 @@ Gem::Specification.new do |s|
s.files = `git ls-files`.split("\n") s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {fixtures,features}/*`.split("\n") s.test_files = `git ls-files -- {fixtures,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"] s.require_paths = ["lib"]
s.add_dependency("middleman-core", Middleman::VERSION) s.add_dependency("middleman-core", Middleman::VERSION)