Pass the filename or pipe the contents of the file into the script.
#> ./camel-to-hyphen-case.rb path/to/file.scss > converted_file.scss
| #!/usr/bin/env ruby | |
| ARGF.each_line do |line| | |
| fixed = line.gsub(/\$([a-z]+[A-Z]{1}[a-zA-Z]+)/) do |v| | |
| v.gsub(/([A-Z]{1})/) do |m| | |
| "-#{m.downcase}" | |
| end | |
| end | |
| begin | |
| $stdout.puts fixed | |
| rescue Errno::EPIPE | |
| exit(74) | |
| end | |
| end |