Skip to content

Instantly share code, notes, and snippets.

@haribote
Created August 14, 2013 01:39
Show Gist options
  • Save haribote/6227321 to your computer and use it in GitHub Desktop.
Save haribote/6227321 to your computer and use it in GitHub Desktop.
Compassで生成されるスプライト画像のファイル名をトリムする
on_sprite_saved do |filename|
if File.exists?(filename)
FileUtils.cp filename, filename.gsub(%r{-s[a-z0-9]{10}\.png$}, '.png')
end
end
on_stylesheet_saved do |filename|
if File.exists?(filename)
css = File.read filename
File.open(filename, 'w+') do |f|
f << css.gsub(%r{-s[a-z0-9]{10}\.png}, '.png')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment