Class: Middleman::CoreExtensions::ExternalHelpers
- Defined in:
- lib/middleman-core/core_extensions/external_helpers.rb
Overview
Load helpers in helpers/
Constant Summary
Constants included from Contracts
Instance Attribute Summary
Attributes inherited from Extension
Instance Method Summary collapse
Methods inherited from Extension
activated_extension, #add_exposed_to_context, #after_build, after_extension_activated, #after_extension_activated, #before_build, #before_configuration, clear_after_extension_callbacks, config, define_setting, expose_to_application, expose_to_config, expose_to_template, global_config, helpers, #initialize, #manipulate_resource_list, option, #ready, resources
Methods included from Contracts
Constructor Details
This class inherits a constructor from Middleman::Extension
Instance Method Details
#after_configuration ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/middleman-core/core_extensions/external_helpers.rb', line 12 def after_configuration helpers_path = File.join(app.root, app.config[:helpers_dir]) return unless File.exist?(helpers_path) glob = File.join(helpers_path, app.config[:helpers_filename_glob]) ::Middleman::Util.glob_directory(glob).each do |filename| module_name = app.config[:helpers_filename_to_module_name_proc].call(filename) next unless module_name require filename next unless Object.const_defined?(module_name.to_sym) app.template_context_class.send :include, Object.const_get(module_name.to_sym) end end |