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
|
|
|
|
2013-05-08 20:37:55 +02:00
|
|
|
begin
|
|
|
|
# Setup default helpers
|
|
|
|
require "middleman-more/core_extensions/default_helpers"
|
|
|
|
Middleman::CoreExtensions::DefaultHelpers.new(app)
|
|
|
|
rescue LoadError
|
2013-05-12 19:35:40 +02:00
|
|
|
$stderr.puts "Default helpers not installed: #{$!}"
|
2013-05-08 20:37:55 +02:00
|
|
|
end
|
2012-05-26 23:15:36 +02:00
|
|
|
|
|
|
|
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!
|
2013-04-21 00:07:00 +02:00
|
|
|
end if ENV["TEST"]
|
2012-08-14 00:39:06 +02:00
|
|
|
|
2013-04-20 23:58:06 +02:00
|
|
|
require "middleman-more/core_extensions/i18n"
|
|
|
|
Middleman::CoreExtensions::Internationalization.register(:i18n)
|
2012-08-14 00:39:06 +02:00
|
|
|
|
2012-05-26 23:15:36 +02:00
|
|
|
# Compass framework
|
2013-05-08 20:37:55 +02:00
|
|
|
begin
|
|
|
|
require "compass"
|
|
|
|
require "middleman-more/core_extensions/compass"
|
|
|
|
Middleman::CoreExtensions::Compass.new(app)
|
|
|
|
rescue LoadError
|
2013-05-12 19:35:40 +02:00
|
|
|
$stderr.puts "Compass not installed: #{$!}"
|
2013-05-08 20:37:55 +02:00
|
|
|
end
|
2012-05-26 23:15:36 +02:00
|
|
|
|
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.
|
2013-04-20 23:58:06 +02:00
|
|
|
require "middleman-more/extensions/cache_buster"
|
|
|
|
Middleman::Extensions::CacheBuster.register
|
2012-05-26 23:15:36 +02:00
|
|
|
|
2013-05-08 20:37:55 +02:00
|
|
|
# RelativeAssets allow any asset path in dynamic templates to be either
|
|
|
|
# relative to the root of the project or use an absolute URL.
|
|
|
|
require "middleman-more/extensions/relative_assets"
|
|
|
|
Middleman::Extensions::RelativeAssets.register
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
require "middleman-more/extensions/asset_host"
|
|
|
|
Middleman::Extensions::AssetHost.register
|
|
|
|
|
2012-05-26 23:15:36 +02:00
|
|
|
# MinifyCss compresses CSS
|
2013-04-20 23:27:25 +02:00
|
|
|
require "middleman-more/extensions/minify_css"
|
|
|
|
Middleman::Extensions::MinifyCss.register
|
2012-05-26 23:15:36 +02:00
|
|
|
|
|
|
|
# MinifyJavascript compresses JS
|
2013-04-20 23:29:51 +02:00
|
|
|
require "middleman-more/extensions/minify_javascript"
|
|
|
|
Middleman::Extensions::MinifyJavascript.register
|
2012-05-26 23:15:36 +02:00
|
|
|
|
|
|
|
# GZIP assets and pages during build
|
2013-04-20 23:15:47 +02:00
|
|
|
require "middleman-more/extensions/gzip"
|
|
|
|
Middleman::Extensions::Gzip.register
|
2012-05-26 23:15:36 +02:00
|
|
|
|
|
|
|
# AssetHash appends a hash of the file contents to the assets filename
|
|
|
|
# to avoid browser caches failing to update to your new content.
|
2013-04-20 22:52:44 +02:00
|
|
|
require "middleman-more/extensions/asset_hash"
|
|
|
|
Middleman::Extensions::AssetHash.register
|
2012-05-26 23:15:36 +02:00
|
|
|
|
|
|
|
# Provide Apache-style index.html files for directories
|
2013-04-20 22:52:44 +02:00
|
|
|
require "middleman-more/extensions/directory_indexes"
|
|
|
|
Middleman::Extensions::DirectoryIndexes.register
|
2012-05-26 23:15:36 +02:00
|
|
|
|
|
|
|
# Lorem provides a handful of helpful prototyping methods to generate
|
|
|
|
# words, paragraphs, fake images, names and email addresses.
|
|
|
|
require "middleman-more/extensions/lorem"
|
2013-04-20 23:15:47 +02:00
|
|
|
Middleman::Extensions::Lorem.new(app)
|
2012-05-26 23:15:36 +02:00
|
|
|
|
|
|
|
# AutomaticImageSizes inspects the images used in your dynamic templates
|
|
|
|
# and automatically adds width and height attributes to their HTML
|
|
|
|
# elements.
|
2013-04-20 22:52:44 +02:00
|
|
|
require "middleman-more/extensions/automatic_image_sizes"
|
|
|
|
Middleman::Extensions::AutomaticImageSizes.register
|
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
|