Skip to content

Instantly share code, notes, and snippets.

@daphotron
Created July 1, 2013 16:01
Show Gist options
  • Select an option

  • Save daphotron/5902134 to your computer and use it in GitHub Desktop.

Select an option

Save daphotron/5902134 to your computer and use it in GitHub Desktop.
Remove last semi-colon within compressed CSS files generated by SASS, place this inside your config.rb.
# Removes the last semi-colon in the CSS block
def cleansemi(filepath)
# puts "cleaning: #{filepath}"
text = File.read(filepath)
replace = text.gsub(/;(.\s*)\}/m, '\1}')
# puts replace
File.open(filepath, "w") {|file| file.puts replace}
end
# Clean semi-colons with the stylesheet callbacks
on_stylesheet_saved do |filepath|
# puts "about to clean: #{filepath}"
cleansemi(filepath)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment