Sha256: 47f3e666f037f4364564e39e51d80b1fec0b13ad93d2e534b873e8cd6eb5fbc1

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 Bytes

Contents

# encoding: utf-8
#

desc "Fix the images path in the jquery-mobile css files and rename css to erb"
task :"jquery_mobile_rails_css_fix" do
  STYLESHEETS_PATH  = "vendor/assets/stylesheets"
  IMAGES_PATH       = "assets/"

  Dir.glob(File.join(STYLESHEETS_PATH, "*.css")).each do |css_file_name|
    puts css_file_name
    file_content = ''
    File.open(css_file_name, "r:UTF-8") do |file|
      file_content = file.read
    end
    file_content.gsub! /url\(images\/([A-Za-z0-9_-]*\.png)\)/ do
      "image-url(\"jquery-mobile/#{$1}\")"
    end

    File.open(css_file_name, 'w') do |file|
      file << file_content
    end

    File.rename(css_file_name, "#{css_file_name}.scss")
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jquery_mobile_rails-1.1.1 lib/development_tasks/jquery_mobile_rails_tasks.rake
jquery_mobile_rails-1.1.0 lib/development_tasks/jquery_mobile_rails_tasks.rake