Sha256: c0dc9129ea52cdba634db20a61c56cf83afc5ed65801cc912ec9b8f9cb0e1077

Contents?: true

Size: 338 Bytes

Versions: 1

Compression:

Stored size: 338 Bytes

Contents

module Nanoc2::Filters
  class RelativizePathsInCSS < Nanoc2::Filter

    identifier :relativize_paths_in_css

    require 'nanoc2/helpers/link_to'
    include Nanoc2::Helpers::LinkTo

    def run(content)
      content.gsub(/url\((['"]?)(\/.+?)\1\)/) do
        'url(' + $1 + relative_path_to($2) + $1 + ')'
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nanoc2-2.2.3 lib/nanoc2/filters/relativize_paths_in_css.rb