Sha256: 6e23e9f8fec1c325a7cc3447bcf67d829738342fb8a0d18cdc26cd0eee16804c

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

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

5 entries across 5 versions & 1 rubygems

Version Path
middleman-core-3.0.0 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.0.rc.4 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.0.rc.3 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.0.rc.2 lib/middleman-core/templates/extension/lib/lib.rb
middleman-core-3.0.0.rc.1 lib/middleman-core/templates/extension/lib/lib.rb