Class: PatternsExtension
- Inherits:
-
Middleman::Extension
- Object
- Middleman::Extension
- PatternsExtension
- Defined in:
- lib/middleman-patterns.rb
Overview
Middleman extension class. Allows overriding default patterns’ directory. Exposes helper methods in helpers.rb to templates in the middleman app. Ignores the patterns directory when building the site by default.
Options:
:patterns_directory
the local directory patterns are stored in, defaults to "patterns"
:build_patterns
whether or not to ignore the patterns directory when building the site
Instance Method Summary collapse
-
#after_configuration ⇒ Object
Handles ignoring the patterns directory during build if this appropriate option is set.
-
#initialize(app, options_hash = {}, &block) ⇒ PatternsExtension
constructor
A new instance of PatternsExtension.
Constructor Details
#initialize(app, options_hash = {}, &block) ⇒ PatternsExtension
Returns a new instance of PatternsExtension.
25 26 27 28 29 |
# File 'lib/middleman-patterns.rb', line 25 def initialize(app, = {}, &block) super app.set :patterns_directory, .patterns_directory end |
Instance Method Details
#after_configuration ⇒ Object
Handles ignoring the patterns directory during build if this appropriate option is set.
32 33 34 |
# File 'lib/middleman-patterns.rb', line 32 def after_configuration @app.ignore(/#{app.config.setting(:patterns_directory).value}\//) unless .build_patterns end |