did this get missed somehow? fix activate, add live_reload to autoload
This commit is contained in:
parent
08a9f45164
commit
5c93bae53b
|
@ -19,9 +19,9 @@
|
||||||
# require "my_extension"
|
# require "my_extension"
|
||||||
# activate MyExtension
|
# activate MyExtension
|
||||||
#
|
#
|
||||||
# This will call the `registered` method in your extension and provide you
|
# This will call the `registered` method in your extension and provide you
|
||||||
# with the `app` parameter which is a Middleman::Server context. From here
|
# with the `app` parameter which is a Middleman::Server context. From here
|
||||||
# you can choose to respond to requests for certain paths or simply attach
|
# you can choose to respond to requests for certain paths or simply attach
|
||||||
# Rack middleware to the stack.
|
# Rack middleware to the stack.
|
||||||
#
|
#
|
||||||
# The built-in features cover a wide range of functions. Some provide helper
|
# The built-in features cover a wide range of functions. Some provide helper
|
||||||
|
@ -33,48 +33,51 @@ module Middleman::Features
|
||||||
# RelativeAssets allow any asset path in dynamic templates to be either
|
# RelativeAssets allow any asset path in dynamic templates to be either
|
||||||
# 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 assets.
|
||||||
# Calls to asset paths in dynamic templates will then rotate through each of
|
# Calls to asset paths in dynamic templates will then rotate through each of
|
||||||
# the asset servers to better spread the load.
|
# 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"
|
||||||
|
|
||||||
# DefaultHelpers are the built-in dynamic template helpers.
|
# DefaultHelpers are the built-in dynamic template helpers.
|
||||||
autoload :DefaultHelpers, "middleman/features/default_helpers"
|
autoload :DefaultHelpers, "middleman/features/default_helpers"
|
||||||
|
|
||||||
# AutomaticImageSizes inspects the images used in your dynamic templates and
|
# AutomaticImageSizes inspects the images used in your dynamic templates and
|
||||||
# automatically adds width and height attributes to their HTML elements.
|
# 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
|
# 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.
|
# for somewhat obfuscating the output and hiding the fact that you're using Haml.
|
||||||
autoload :UglyHaml, "middleman/features/ugly_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"
|
||||||
|
|
||||||
# Slickmap (http://astuteo.com/slickmap/) is a beautiful sitemap tool which
|
# Slickmap (http://astuteo.com/slickmap/) is a beautiful sitemap tool which
|
||||||
# will attempt to generate a `sitemap.html` file from your project.
|
# will attempt to generate a `sitemap.html` file from your project.
|
||||||
autoload :Slickmap, "middleman/features/slickmap"
|
autoload :Slickmap, "middleman/features/slickmap"
|
||||||
|
|
||||||
# SmushPngs uses Yahoo's Smush.it API to compresses PNGs and JPGs. Often times
|
# SmushPngs uses Yahoo's Smush.it API to compresses PNGs and JPGs. Often times
|
||||||
# the service can decrease the size of Photoshop-exported images by 30-50%
|
# the service can decrease the size of Photoshop-exported images by 30-50%
|
||||||
autoload :SmushPngs, "middleman/features/smush_pngs"
|
autoload :SmushPngs, "middleman/features/smush_pngs"
|
||||||
|
|
||||||
# CodeRay is a syntax highlighter.
|
# CodeRay is a syntax highlighter.
|
||||||
autoload :CodeRay, "middleman/features/code_ray"
|
autoload :CodeRay, "middleman/features/code_ray"
|
||||||
|
|
||||||
# Lorem provides a handful of helpful prototyping methods to generate words,
|
# Lorem provides a handful of helpful prototyping methods to generate words,
|
||||||
# paragraphs, fake images, names and email addresses.
|
# paragraphs, fake images, names and email addresses.
|
||||||
autoload :Lorem, "middleman/features/lorem"
|
autoload :Lorem, "middleman/features/lorem"
|
||||||
|
|
||||||
|
# auto-reload browser after changes
|
||||||
|
autoload :LiveReload, "middleman/features/live_reload"
|
||||||
|
|
||||||
# The Feature API is itself a Feature. Mind blowing!
|
# The Feature API is itself a Feature. Mind blowing!
|
||||||
class << self
|
class << self
|
||||||
def registered(app)
|
def registered(app)
|
||||||
|
@ -82,24 +85,28 @@ module Middleman::Features
|
||||||
end
|
end
|
||||||
alias :included :registered
|
alias :included :registered
|
||||||
end
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
# This method is available in the project's `config.rb`.
|
# This method is available in the project's `config.rb`.
|
||||||
# It takes a underscore-separated symbol, finds the appropriate
|
# It takes a underscore-separated symbol, finds the appropriate
|
||||||
# feature module and includes it.
|
# feature module and includes it.
|
||||||
#
|
#
|
||||||
# activate :lorem
|
# activate :lorem
|
||||||
#
|
#
|
||||||
# Alternatively, you can pass in a Middleman feature module directly.
|
# Alternatively, you can pass in a Middleman feature module directly.
|
||||||
#
|
#
|
||||||
# activate MyFeatureModule
|
# activate MyFeatureModule
|
||||||
def activate(feature_name)
|
def activate(feature)
|
||||||
feature_name = feature_name.to_s if feature_name.class == Symbol
|
feature = feature.to_s if feature.is_a? Symbol
|
||||||
feature_name = Middleman::Features.const_get(feature_name.camelize) if feature_name.class == String if Middleman::Features.const_defined?(mod_name)
|
|
||||||
|
if feature.is_a? String
|
||||||
register feature_name
|
feature = feature.camelize
|
||||||
|
feature = Middleman::Features.const_get(feature)
|
||||||
|
end
|
||||||
|
|
||||||
|
register feature
|
||||||
end
|
end
|
||||||
|
|
||||||
# Deprecated API. Please use `activate` instead.
|
# Deprecated API. Please use `activate` instead.
|
||||||
def enable(feature_name)
|
def enable(feature_name)
|
||||||
$stderr.puts "Warning: Feature activation has been renamed from enable to activate"
|
$stderr.puts "Warning: Feature activation has been renamed from enable to activate"
|
||||||
|
|
Loading…
Reference in a new issue