Created
February 3, 2011 02:20
-
-
Save nikolaiwarner/808920 to your computer and use it in GitHub Desktop.
Thor scripts for bulk converting files to haml and sass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2011 Nikolai Warner <n@nikolaiwarner.com> | |
# Originally inspired by divoxx at http://snippets.dzone.com/posts/show/5449 | |
class ConvertAll < Thor | |
desc "to_haml [path]", "convert all erb files to haml in [path]" | |
def to_haml(path='.') | |
delete_when_done = yes?("Remove erb files after conversion? (y/n): ") | |
Dir["#{path}/**/*.erb"].each do |file| | |
`html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}` | |
`rm #{file}` if delete_when_done | |
end | |
end | |
desc "to_sass [path]", "convert all css files to sass in [path]" | |
def to_sass(path='.') | |
Dir["#{path}/**/*.css"].each do |file| | |
`sass-convert #{file} #{file.gsub(/\.css$/, '.sass')}` | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment