Sha256: f5ae3ce95802490d81eda8e9918c0a90536be95641fc33f669ce63e5826019dc

Contents?: true

Size: 580 Bytes

Versions: 2

Compression:

Stored size: 580 Bytes

Contents

class Middleman::Base
  if compass?
    configure do
      ::Compass.configuration do |config|
        config.relative_assets = true
      end
    end
  end
  
  helpers do
    def asset_url(path)
      if path.include?("://")
        path
      else
        request_path = request.path_info.dup
        request_path << "index.html" 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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
middleman-0.9.4 lib/middleman/features/relative_assets.rb
middleman-0.9.3 lib/middleman/features/relative_assets.rb