Skip to content

Instantly share code, notes, and snippets.

Created December 6, 2012 11:18
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 anonymous/4223777 to your computer and use it in GitHub Desktop.
Save anonymous/4223777 to your computer and use it in GitHub Desktop.
generate css for glyphicons - 結果をリダイレクトでファイルに書き込んで下さい
print ".glyphicons{
display: inline-block;
margin-top: 1px;
*margin-right: .3em;
vertical-align: text-top;
background-repeat: no-repeat;
}"
Dir::glob("./**/*.png"){|png|
file_name = png.split('/').last
class_name = file_name.split('_', 3).last.split('.')[0]
identify = `identify #{png}`
size = identify.split(" ")[2]
width = size.split("x")[0]
height = size.split("x")[1]
print "
.glyphicons-#{class_name} {
background-image: url('#{png}');
width: #{width}px;
height: #{height}px;
line-height: #{height}px;
}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment