Sha256: 9824aea923a7f9ad2e6fdc44ca1c358f4e9533aafcb0930fd54df8ec719c8737

Contents?: true

Size: 844 Bytes

Versions: 6

Compression:

Stored size: 844 Bytes

Contents

# Base helper to manipulate asset paths
module Middleman::CoreExtensions::Assets
  
  # Extension registered
  class << self
    # @private
    def registered(app)
      # Disable Padrino cache buster
      app.set :asset_stamp, false
      
      # Include helpers
      app.send :include, InstanceMethod
    end
    alias :included :registered
  end
  
  # Methods to be mixed-in to Middleman::Base
  module InstanceMethod
    
    # Get the URL of an asset given a type/prefix
    #
    # @param [String] path The path (such as "photo.jpg")
    # @param [String] prefix The type prefix (such as "images")
    # @return [String] The fully qualified asset url
    def asset_url(path, prefix="")
      # Don't touch assets which already have a full path
      path.include?("://") ? path : File.join(http_prefix, prefix, path)
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
middleman-core-3.0.0.beta.1 lib/middleman-core/core_extensions/assets.rb
middleman-core-3.0.0.alpha.9 lib/middleman-core/core_extensions/assets.rb
middleman-core-3.0.0.alpha.8 lib/middleman-core/core_extensions/assets.rb
middleman-core-3.0.0.alpha.7 lib/middleman-core/core_extensions/assets.rb
middleman-3.0.0.alpha.6 lib/middleman/core_extensions/assets.rb
middleman-3.0.0.alpha.5 lib/middleman/core_extensions/assets.rb