Sha256: 6e30ed13905bb1619f4e0baf76bc61863e3424f8d420d55c14e7a949e1fdac29

Contents?: true

Size: 1.87 KB

Versions: 13

Compression:

Stored size: 1.87 KB

Contents

require 'fileutils'

namespace :haml do
  desc "Convert .erb views to haml and stylesheets to sass"
  task :from_erb do
    puts ".erb to .haml started"
    path = File.join(RAILS_ROOT, 'app', 'views')
    puts path
    Dir["#{path}/**/*.erb"].each do |file|
      system "html2haml -x #{file} #{file.gsub(/\.erb$/, '.haml')}"
      puts "Converted: #{file}"
    end
    path = File.join(RAILS_ROOT, 'public', 'stylesheets')
    puts path
    Dir["#{path}/**/*.css"].each do |file|
      next unless /\/compiled\/$/ =~ file
      system "css2sass #{file} #{file.gsub(/\.css$/, '.sass')}"
      puts "Converted: #{file}"
    end
    puts ".erb to .haml finished"
  end
  
  desc "Convert .html views to haml and stylesheets to sass"
  task :from_html do
    puts ".html to .haml started"
    path = File.join(RAILS_ROOT, 'app', 'views')
    puts path
    Dir["#{path}/**/*.html"].each do |file|
      system "html2haml -x #{file} #{file.gsub(/\.html$/, '.html.haml')}"
      puts "Converted: #{file}"
    end
    Dir["#{path}/**/*.css"].each do |file|
      system "sass-convert -F scss -T scss #{file} #{file.gsub(/\.css$/, '.scss')}"
      puts "Converted: #{file}"
    end
    puts ".html to .haml finished"
  end
  
  desc "Convert .html views to .html.haml and .js.haml and stylesheets to sass"
  task :from_demo do
    puts "Demo to .haml started"
    path = File.join(RAILS_ROOT, 'app', 'views')
    puts path
    Dir["#{path}/**/*.html"].each do |file|
      system "html2haml -x #{file} #{file.gsub(/\.html$/, '.html.haml')}"
      system "html2haml -x #{file} #{file.gsub(/\.html$/, '.js.haml')}"
      puts "Converted: #{file}"
    end
    Dir["#{path}/**/*.css"].each do |file|
      system "sass-convert -F scss -T scss #{file} #{file.gsub(/\.css$/, '.scss')}"
      puts "Converted: #{file}"
    end
    puts "Demo to .haml finished"
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
compass-jquery-plugin-0.3.2.3 templates/jquery/lib/tasks/haml.rake
compass-jquery-plugin-0.3.2.2 templates/jquery/lib/tasks/haml.rake
compass-jquery-plugin-0.3.2.1 templates/jquery/lib/tasks/haml.rake
compass-jquery-plugin-0.3.2.0 templates/jquery/lib/tasks/haml.rake
compass-jquery-plugin-0.3.2.pre.2 templates/jquery/lib/tasks/haml.rake
compass-jquery-plugin-0.3.1.1 templates/jrails/lib/tasks/haml.rake
compass-jquery-plugin-0.3.1.0 templates/jrails/lib/tasks/haml.rake
compass-jquery-plugin-0.3.1.beta.3 templates/jrails/lib/tasks/haml.rake
compass-jquery-plugin-0.3.1.beta.2 templates/jrails/lib/tasks/haml.rake
compass-jquery-plugin-0.3.0.0 templates/jrails/lib/tasks/haml.rake
compass-jquery-plugin-0.3.0.rc.1 templates/jrails/lib/tasks/haml.rake
compass-jquery-plugin-0.3.0.beta.26 templates/jrails/lib/tasks/haml.rake
compass-jquery-plugin-0.3.0.beta.25 templates/jrails/lib/tasks/haml.rake