Class: Middleman::Gdpr::Extension
- Inherits:
-
Extension
- Object
- Extension
- Middleman::Gdpr::Extension
- Defined in:
- lib/middleman-gdpr/extension.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#after_configuration ⇒ Object
def initialize(app, options_hash={}, &block) super end.
- #root ⇒ Object
Class Method Details
.root ⇒ Object
32 33 34 |
# File 'lib/middleman-gdpr/extension.rb', line 32 def root Pathname.new(__dir__) + '../..' end |
.template_for(partial) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/middleman-gdpr/extension.rb', line 36 def template_for(partial) partial = File.basename(partial.to_s) .sub(/\A_/, '') .sub(/\.(html|erb|html\.erb)\z/, '') path = root + "source/gdpr/_#{partial}.html.erb" return File.read path if File.exists? path end |
Instance Method Details
#after_configuration ⇒ Object
def initialize(app, options_hash={}, &block)
super
end
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/middleman-gdpr/extension.rb', line 8 def after_configuration raise "\e[91mGDPR: Sprockets extension not activated. Please activate Sprockets in config.rb\e[39m" if sprockets.blank? raise "\e[91mGDPR: I18n extension not activated. Please activate I18n in config.rb\e[39m" if i18n.blank? ['source/stylesheets', 'source/javascripts', 'node_modules'].each do |path| sprockets.environment.append_path root + path end I18n.load_path.concat Dir[root + 'locales/*.yml'] end |
#root ⇒ Object
19 20 21 |
# File 'lib/middleman-gdpr/extension.rb', line 19 def root self.class.root end |