Skip to content

Instantly share code, notes, and snippets.

@tav
Created October 15, 2012 03:18
Show Gist options
  • Select an option

  • Save tav/3890661 to your computer and use it in GitHub Desktop.

Select an option

Save tav/3890661 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
import glue
class Image(glue.Image):
@glue.cached_property
def class_name(self):
return 'emoji-%s' % self.filename.replace('+', r'\+')
glue.Image = Image
class DummyConfig(object):
algorithm = 'square'
cachebuster = False
cachebuster_filename = None
crop = False
css_dir = None
each_template = "%(class_name)s{background-position:%(x)s %(y)s;width:%(width)s;height:%(height)s;}\n"
global_template = "%(all_classes)s{background-image:url('%(sprite_url)s');background-repeat:no-repeat}\n"
html = False
ignore_filename_paddings = False
img_dir = None
less = False
margin = '0'
namespace = ''
optipng = True
optipngpath = 'optipng'
ordering = 'maxside'
padding = '0'
png8 = False
quiet = False
# ratio_template
ratios = ''
retina = None
separator = '-'
url = ''
def extend(self, param):
return self
sprites = glue.SimpleSpriteManager('emoji', DummyConfig(), 'sprites')
sprites.process()
f = open('sprites/emoji.css', 'rb')
css = f.read()
f.close()
f = open('sprites/emoji.css', 'wb')
f.write(css.replace(',\n', ',').replace('0px', '0'))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment