Sha256: d94ab429a0299e93e24e72374fcd10f2c37cbd691e96b996f8392c888dcebda3

Contents?: true

Size: 991 Bytes

Versions: 35

Compression:

Stored size: 991 Bytes

Contents

# Require core library
require "middleman-core"

# Extension namespace
module MyExtension
  class << self

    # Called when user `activate`s your extension
    def registered(app, options={})
      # Setup extension-specific config
      app.set :config_variable, false

      # Include class methods
      # app.extend ClassMethods

      # Include instance methods
      # app.send :include, InstanceMethods

      app.after_configuration do
        # Do something

        # config_variable is now either the default or the user's
        # setting from config.rb
      end
    end
    alias :included :registered
  end

  # module ClassMethods
  #   def a_class_method
  #   end
  # end

  # module InstanceMethods
  #   def an_instance_method
  #   end
  # end

end


# Register extensions which can be activated
# Make sure we have the version of Middleman we expect
# ::Middleman::Extensions.register(:extension_name) do
#
#   # Return the extension module
#   ::MyExtension
#
# end

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
middleman-core-x86-mingw32-3.0.14 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.14 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-x86-mingw32-3.0.13 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.13 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-x86-mingw32-3.0.12 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.12 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-x86-mingw32-3.0.12.pre.1 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.12.pre.1 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-x86-mingw32-3.0.11 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.11 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-x86-mingw32-3.0.10 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-x86-mingw32-3.0.10.pre.1 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.10.pre.1 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-x86-mingw32-3.0.9 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.9 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-x86-mingw32-3.0.8 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.8 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-x86-mingw32-3.0.8.pre.2 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.8.pre.2 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-x86-mingw32-3.0.8.pre.1 lib/middleman-core/templates/extension/lib/lib.rb