Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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