Sha256: 2eb6fe05602015ba83ac20992a27abed98768d7b11431cc475f8f8f8f6f14203

Contents?: true

Size: 630 Bytes

Versions: 2

Compression:

Stored size: 630 Bytes

Contents

module Path
  class Findr

    def initialize chunk, ns = nil
      @chunk = chunk
      @ns = ns
      matches
    end

    def sass?
      true
    end

    def replace src
      if sass?
        "image-url('#{@ns}#{src}')"
      else
        "url('<%= image_path(#{@ns}#{src}) %>)"
      end
    end

    def matches
      @images = @chunk.scan(/url\((.*)\)/).flatten
    end

    def images
      @images
    end

    def fixed
      sprocketized = @chunk
      @images.each do |uri|
        sprocketized["url(#{uri})"] = replace uri.split("/").last
        #gsub(/\.|\//, "")
      end
      sprocketized
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
assetify-1.0.0 lib/assetify/asset/pathfix.rb
assetify-1.0.0.rc1 lib/assetify/asset/pathfix.rb