Skip to content

Instantly share code, notes, and snippets.

@rap1ds
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rap1ds/9830087 to your computer and use it in GitHub Desktop.
Save rap1ds/9830087 to your computer and use it in GitHub Desktop.
Remove all whitespaces from Rails project: Run the script in Rails console
Dir.glob("app/**/*").select { |filename| ["rb", "js", "css", "scss", "erb", "haml", "yml"].include? filename.split(".").last }.each { |filename|
stripped = `git stripspace < #{filename}`
File.open(filename, 'w') { |file| file.write(stripped) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment