Skip to content

Instantly share code, notes, and snippets.

@esetomo
Created May 6, 2014 12:26
Show Gist options
  • Save esetomo/220897abf23c1179ea0e to your computer and use it in GitHub Desktop.
Save esetomo/220897abf23c1179ea0e to your computer and use it in GitHub Desktop.
Inkscapeでsvgファイルが保存されたら各サイズのアイコンPNGファイルを生成
guard :shell do
watch(%r{(.+)\.svg}) do |m|
%w(Small 40 60 76).each do |size|
['', '@2x'].each do |scale|
width = size.to_i
width = 32 if width == 0
width *= 2 if scale == '@2x'
system("inkscape #{m[0]} --export-png=#{m[1]}-#{size}#{scale}.png --export-area-page --export-width=#{width}")
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment