Sha256: 2a9ac3a418dce043c88de4e1599c2049c5bebcdf9bca5f953bb79d21b8b6acfd

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

require 'bundler'
Bundler.require

namespace :assets do
  desc 'Update css files to correctly load background images'
  task :css do
    puts "Looking for css files containing background(-image)?:url ..."
    src = /background(\-image)?[\s+]?\:(.*?)url\((\W+)?([^\.]*)\.(\w+)(\W+)?\)/
    dst = 'background\1:\2url(\3\4.\5%s\6)' % EL::FinderHelpers::ASSETS_EXT
    Dir[File.expand_path('../assets/**/*.css', __FILE__)].each do |file|
      css = File.read(file)
      if css =~ src
        puts "Updating #{file}"
        File.open(file, 'w') {|f| f << css.gsub(src, dst)}
      end
    end
    puts "Done"
  end
end

Bundler::GemHelper.install_tasks

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
el-finder-0.1.0 Rakefile