Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jorgebastida/glue
...
head fork: jorgebastida/glue
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 29 additions and 5 deletions.
  1. +5 −5 docs/paddings.rst
  2. +3 −0  glue.py
  3. +21 −0 tests.py
View
10 docs/paddings.rst
@@ -12,17 +12,17 @@ This small change means that the ``rainbow.png`` image needs a ``10px`` padding
.. image:: _static/famfamfam3.png
-If you don't need the same padding all around the image, you can use ``_10_20`` for a ``10px 20px 10px 20px`` padding or
-``_10_20_30_40`` for a ``10px 20px 30px 40px`` padding as this table shows:
+If you don't need the same padding all around the image, you can use ``_10-20`` for a ``10px 20px 10px 20px`` padding or
+``_10-20-30-40`` for a ``10px 20px 30px 40px`` padding as this table shows:
=================== =========================
filename padding
=================== =========================
cat.png 0px 0px 0px 0px
cat_20.png 20px 20px 20px 20px
-cat_20_30.png 20px 30px 20px 30px
-cat_20_30_40.png 20px 30px 40px 30px
-cat_20_30_40_50.png 20px 30px 40px 30px
+cat_20-30.png 20px 30px 20px 30px
+cat_20-30-40.png 20px 30px 40px 30px
+cat_20-30-40-50.png 20px 30px 40px 30px
=================== =========================
View
3  glue.py
@@ -337,6 +337,7 @@ def class_name(self):
padding_info_name = '_%s' % padding_info_name
name = name[:len(padding_info_name) * -1 or None]
name = re.sub(r'[^\w\-_]', '', name)
+
return '%s-%s' % (self.sprite.namespace, name)
@property
@@ -559,6 +560,8 @@ def save_css(self):
@property
def namespace(self):
"""Return the namespace for this sprite."""
+ if not self.config.namespace:
+ return self.name
return '%s-%s' % (self.config.namespace, self.name)
@property
View
21 tests.py
@@ -99,6 +99,14 @@
.abc-verysimple-green{background-position:-25px 0px;width:25px;height:25px;}
.abc-verysimple-blue{background-position:0px -25px;width:25px;height:25px;}"""
+EXPECTED_VERYSIMPLE_EMPTYNAMESPACE = """
+.verysimple-red,
+.verysimple-green,
+.verysimple-blue{background-image:url(verysimple.png);background-repeat:no-repeat;}
+.verysimple-red{background-position:0px 0px;width:25px;height:25px;}
+.verysimple-green{background-position:-25px 0px;width:25px;height:25px;}
+.verysimple-blue{background-position:0px -25px;width:25px;height:25px;}"""
+
class SimpleCssCompiler(object):
@@ -448,6 +456,19 @@ def test_namespace(self):
self.assertEqualCSS(css.read(), EXPECTED_VERYSIMPLE_NAMESPACE)
css.close()
+ # Empty namespace
+ manager = self.generate_manager(glue.SimpleSpriteManager,
+ 'verysimple',
+ {'namespace': ''})
+ manager.process()
+
+ css_path = os.path.join(self.output_path, 'verysimple.css')
+ self.assertTrue(os.path.isfile(css_path))
+
+ css = open(css_path)
+ self.assertEqualCSS(css.read(), EXPECTED_VERYSIMPLE_EMPTYNAMESPACE)
+ css.close()
+
def test_cachebuster(self):
manager = self.generate_manager(glue.SimpleSpriteManager,
'verysimple',

No commit comments for this range

Something went wrong with that request. Please try again.