Sha256: 1d6d31df768e26cd8675a6137ac71dfb8233d7707cbdcbbf032fcf834dcf516b

Contents?: true

Size: 763 Bytes

Versions: 12

Compression:

Stored size: 763 Bytes

Contents

::Compass.configuration do |config|
  config.relative_assets = true
end

class << Middleman::Base
  alias_method :pre_relative_asset_url, :asset_url
  def asset_url(path, prefix="", request=nil)
    begin
      prefix = self.images_dir if prefix == self.http_images_path
    rescue
    end
    
    path = pre_relative_asset_url(path, prefix, request)
    if path.include?("://")
      path
    else
      path = path[1,path.length-1] if path[0,1] == '/'
      request_path = request.path_info.dup
      request_path << self.class.index_file if path.match(%r{/$})
      request_path.gsub!(%r{^/}, '')
      parts = request_path.split('/')
    
      if parts.length > 1
        "../" * (parts.length - 1) + path
      else
        path
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
middleman-0.10.7 lib/middleman/features/relative_assets.rb
middleman-0.10.6 lib/middleman/features/relative_assets.rb
middleman-0.10.5 lib/middleman/features/relative_assets.rb
middleman-0.10.4 lib/middleman/features/relative_assets.rb
middleman-0.10.3 lib/middleman/features/relative_assets.rb
middleman-0.10.2 lib/middleman/features/relative_assets.rb
middleman-0.10.1 lib/middleman/features/relative_assets.rb
middleman-0.10.0 lib/middleman/features/relative_assets.rb
middleman-0.9.23 lib/middleman/features/relative_assets.rb
middleman-0.9.22 lib/middleman/features/relative_assets.rb
middleman-0.9.21 lib/middleman/features/relative_assets.rb
middleman-0.9.20 lib/middleman/features/relative_assets.rb