2012-05-25 01:14:17 +02:00
|
|
|
require "middleman-core"
|
|
|
|
|
2011-12-30 00:09:51 +01:00
|
|
|
# Setup our load paths
|
|
|
|
libdir = File.expand_path(File.dirname(__FILE__))
|
|
|
|
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|
|
|
|
2012-05-26 23:15:36 +02:00
|
|
|
module Middleman
|
|
|
|
module More
|
2012-08-14 00:39:06 +02:00
|
|
|
|
2012-05-26 23:15:36 +02:00
|
|
|
# Setup extension
|
|
|
|
class << self
|
|
|
|
|
|
|
|
# Once registered
|
|
|
|
def registered(app, options={})
|
2012-08-14 00:39:06 +02:00
|
|
|
###
|
2012-05-26 23:15:36 +02:00
|
|
|
# Setup Core Extensions
|
|
|
|
###
|
2012-08-14 22:47:11 +02:00
|
|
|
|
|
|
|
require "middleman-core/templates"
|
|
|
|
require "middleman-more/templates/smacss"
|
2012-05-26 23:15:36 +02:00
|
|
|
|
|
|
|
# Setup default helpers
|
|
|
|
require "middleman-more/core_extensions/default_helpers"
|
|
|
|
Middleman::Application.register Middleman::CoreExtensions::DefaultHelpers
|
|
|
|
|
|
|
|
# i18n
|
|
|
|
require "i18n"
|
|
|
|
app.after_configuration do
|
|
|
|
# This is for making the tests work - since the tests
|
|
|
|
# don't completely reload middleman, I18n.load_path can get
|
2012-08-14 00:39:06 +02:00
|
|
|
# polluted with paths from other test app directories that don't
|
2012-05-26 23:15:36 +02:00
|
|
|
# exist anymore.
|
|
|
|
::I18n.load_path.delete_if {|path| path =~ %r{tmp/aruba}}
|
|
|
|
::I18n.reload!
|
|
|
|
end
|
2012-08-14 00:39:06 +02:00
|
|
|
|
2012-05-26 23:15:36 +02:00
|
|
|
Middleman::Extensions.register(:i18n) do
|
|
|
|
require "middleman-more/core_extensions/i18n"
|
2012-06-06 04:11:05 +02:00
|
|
|
Middleman::CoreExtensions::Internationalization
|
2012-05-26 23:15:36 +02:00
|
|
|
end
|
2012-08-14 00:39:06 +02:00
|
|
|
|
2012-05-26 23:15:36 +02:00
|
|
|
# Compass framework
|
|
|
|
require "middleman-more/core_extensions/compass"
|
|
|
|
Middleman::Application.register Middleman::CoreExtensions::Compass
|
|
|
|
|
2012-08-14 00:39:06 +02:00
|
|
|
###
|
2012-05-26 23:15:36 +02:00
|
|
|
# Setup Optional Extensions
|
|
|
|
###
|
|
|
|
|
2012-08-14 00:39:06 +02:00
|
|
|
# CacheBuster adds a query string to assets in dynamic templates to
|
|
|
|
# avoid browser caches failing to update to your new content.
|
2012-05-26 23:15:36 +02:00
|
|
|
Middleman::Extensions.register(:cache_buster) do
|
|
|
|
require "middleman-more/extensions/cache_buster"
|
2012-08-14 00:39:06 +02:00
|
|
|
Middleman::Extensions::CacheBuster
|
2012-05-26 23:15:36 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# MinifyCss compresses CSS
|
|
|
|
Middleman::Extensions.register(:minify_css) do
|
|
|
|
require "middleman-more/extensions/minify_css"
|
2012-08-14 00:39:06 +02:00
|
|
|
Middleman::Extensions::MinifyCss
|
2012-05-26 23:15:36 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# MinifyJavascript compresses JS
|
|
|
|
Middleman::Extensions.register(:minify_javascript) do
|
|
|
|
require "middleman-more/extensions/minify_javascript"
|
2012-08-14 00:39:06 +02:00
|
|
|
Middleman::Extensions::MinifyJavascript
|
2012-05-26 23:15:36 +02:00
|
|
|
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"
|
2012-08-14 00:39:06 +02:00
|
|
|
Middleman::Extensions::RelativeAssets
|
2012-05-26 23:15:36 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# GZIP assets and pages during build
|
|
|
|
Middleman::Extensions.register(:gzip) do
|
|
|
|
require "middleman-more/extensions/gzip"
|
2012-08-14 00:39:06 +02:00
|
|
|
Middleman::Extensions::Gzip
|
2012-05-26 23:15:36 +02:00
|
|
|
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"
|
2012-08-14 00:39:06 +02:00
|
|
|
Middleman::Extensions::AssetHash
|
2012-05-26 23:15:36 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
Middleman::Extensions.register(:asset_host) do
|
|
|
|
require "middleman-more/extensions/asset_host"
|
2012-08-14 00:39:06 +02:00
|
|
|
Middleman::Extensions::AssetHost
|
2012-05-26 23:15:36 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# Provide Apache-style index.html files for directories
|
|
|
|
Middleman::Extensions.register(:directory_indexes) do
|
|
|
|
require "middleman-more/extensions/directory_indexes"
|
2012-08-14 00:39:06 +02:00
|
|
|
Middleman::Extensions::DirectoryIndexes
|
2012-05-26 23:15:36 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# Lorem provides a handful of helpful prototyping methods to generate
|
|
|
|
# words, paragraphs, fake images, names and email addresses.
|
|
|
|
require "middleman-more/extensions/lorem"
|
|
|
|
Middleman::Application.register Middleman::Extensions::Lorem
|
|
|
|
|
|
|
|
# AutomaticImageSizes inspects the images used in your dynamic templates
|
|
|
|
# and automatically adds width and height attributes to their HTML
|
|
|
|
# elements.
|
|
|
|
Middleman::Extensions.register(:automatic_image_sizes) do
|
|
|
|
require "middleman-more/extensions/automatic_image_sizes"
|
|
|
|
Middleman::Extensions::AutomaticImageSizes
|
|
|
|
end
|
2012-05-25 01:14:17 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-06-06 04:11:05 +02:00
|
|
|
Middleman::Application.register Middleman::More
|