Sha256: f036de10d8a5ca8999399b9f36c59bcd7ac6060a5076ac158539581451805106

Contents?: true

Size: 910 Bytes

Versions: 2

Compression:

Stored size: 910 Bytes

Contents

module SvgHeartsYou
  module Extensions
    class MiddlemanExtension < Middleman::Extension
      option :svg_paths, [], 'Used to set custom search path for SvgHeartsYou gem'

      def initialize(app, options_hash={}, &block)
        super

        # Configure gem if svg_paths option is set via middleman
        if options_hash.key?(:svg_paths)
          SvgHeartsYou.configure do |config|
            config.svg_paths << options_hash[:svg_paths]
          end
        end
      end

      helpers do
        include SvgHeartsYou::Helpers
      end

      def after_configuration
        # Add middleman app's images_dir by default
        SvgHeartsYou.configure do |config|
          config.svg_paths << File.join(Dir.pwd, app.settings.source, app.settings.images_dir)
        end
      end
    end
  end
end

::Middleman::Extensions.register(:svg_hearts_you, SvgHeartsYou::Extensions::MiddlemanExtension)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
svg_hearts_you-0.0.2 lib/svg_hearts_you/middleman_extension.rb
svg_hearts_you-0.0.1 lib/svg_hearts_you/middleman_extension.rb