Sha256: 27a9c8125edaa66d512bce713f68eaf5f9c113b7122f11200273f90382ce9cf1
Contents?: true
Size: 1.06 KB
Versions: 5
Compression:
Stored size: 1.06 KB
Contents
# Extension namespace module Middleman module Extensions # Relative Assets extension module RelativeAssets # Setup extension class << self # Once registered def registered(app) # Tell compass to use relative assets app.compass_config do |config| config.relative_assets = true end # Include instance methods app.send :include, InstanceMethods end alias :included :registered end # Relative Assets instance method module InstanceMethods # asset_url override for relative assets # @param [String] path # @param [String] prefix # @return [String] def asset_url(path, prefix="") path = super(path, prefix) if path.include?("//") || !current_resource path else current_dir = Pathname('/' + current_resource.destination_path) Pathname(path).relative_path_from(current_dir.dirname).to_s end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems