Sha256: 0d7a67fe839161015db41583a04bc22f010923313a9eca3740cd6e32a621e8ec

Contents?: true

Size: 871 Bytes

Versions: 3

Compression:

Stored size: 871 Bytes

Contents

require 'middleman-core'

module Middleman
  module CDN
    module Helpers
      def cdn_options
        ::Middleman::CDN::CDNExtension.options
      end
    end

    class CDNExtension < Middleman::Extension
      option :cloudflare, nil, 'CloudFlare options'
      option :cloudfront, nil, 'CloudFront options'
      option :filter, nil, 'Cloudflare options'
      option :after_build, false, 'Cloudflare options'

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

        @@cdn_options = options

        app.after_configuration do
          app.after_build do
            ::Middleman::Cli::CDN.new.invalidate(@@cdn_options) if @@cdn_options.after_build
          end
        end

        app.send :include, Helpers
      end

      def registered
        included
      end

      def self.options
        @@cdn_options
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
middleman-cdn-0.1.5 lib/middleman-cdn/extension.rb
middleman-cdn-0.1.3 lib/middleman-cdn/extension.rb
middleman-cdn-0.1.2 lib/middleman-cdn/extension.rb