diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-27 15:42:12 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-27 15:42:12 -0700 |
commit | 6dad0e9ed0a651c43564ea71d0a16624cc56a2fd (patch) | |
tree | e07999bd8fa719daa5097cd2ff8aa4b7bd5da149 | |
parent | 52eaeed67473b190e1bae47b3b8373360c2e94b5 (diff) | |
download | pyscss-6dad0e9ed0a651c43564ea71d0a16624cc56a2fd.tar.gz |
Move bootstrap to an extension.
-rw-r--r-- | scss/extension/bootstrap.py | 26 | ||||
-rw-r--r-- | scss/functions/__init__.py | 1 | ||||
-rw-r--r-- | scss/functions/bootstrap.py | 17 | ||||
-rw-r--r-- | scss/legacy.py | 2 |
4 files changed, 28 insertions, 18 deletions
diff --git a/scss/extension/bootstrap.py b/scss/extension/bootstrap.py new file mode 100644 index 0000000..76cdb02 --- /dev/null +++ b/scss/extension/bootstrap.py @@ -0,0 +1,26 @@ +from __future__ import absolute_import +from __future__ import print_function +from __future__ import unicode_literals +from __future__ import division + +from scss.extension import Extension +from scss.namespace import Namespace +from scss.functions.compass.helpers import _font_url +from scss.functions.compass.images import _image_url + + +class BootstrapExtension(Extension): + name = 'bootstrap' + namespace = Namespace() + +ns = BootstrapExtension.namespace + + +@ns.declare +def twbs_font_path(path): + return _font_url(path, False, True, False) + + +@ns.declare +def twbs_image_path(path): + return _image_url(path, False, True, None, None, False, None, None, None, None) diff --git a/scss/functions/__init__.py b/scss/functions/__init__.py index 76dc525..4c775f6 100644 --- a/scss/functions/__init__.py +++ b/scss/functions/__init__.py @@ -7,7 +7,6 @@ from scss.functions.compass.sprites import COMPASS_SPRITES_LIBRARY from scss.functions.compass.gradients import COMPASS_GRADIENTS_LIBRARY from scss.functions.compass.helpers import COMPASS_HELPERS_LIBRARY from scss.functions.compass.images import COMPASS_IMAGES_LIBRARY -from scss.functions.bootstrap import BOOTSTRAP_LIBRARY COMPASS_LIBRARY = FunctionLibrary() diff --git a/scss/functions/bootstrap.py b/scss/functions/bootstrap.py deleted file mode 100644 index 084eff5..0000000 --- a/scss/functions/bootstrap.py +++ /dev/null @@ -1,17 +0,0 @@ -from scss.functions.library import FunctionLibrary -from scss.functions.compass.helpers import _font_url -from scss.functions.compass.images import _image_url - - -BOOTSTRAP_LIBRARY = FunctionLibrary() -register = BOOTSTRAP_LIBRARY.register - - -@register('twbs-font-path', 1) -def twbs_font_path(path): - return _font_url(path, False, True, False) - - -@register('twbs-image-path', 1) -def twbs_image_path(path): - return _image_url(path, False, True, None, None, False, None, None, None, None) diff --git a/scss/legacy.py b/scss/legacy.py index d44d71e..90016a2 100644 --- a/scss/legacy.py +++ b/scss/legacy.py @@ -8,6 +8,7 @@ import six from scss.compiler import Compiler import scss.config as config from scss.expression import Calculator +from scss.extension.bootstrap import BootstrapExtension from scss.extension.core import CoreExtension from scss.extension.extra import ExtraExtension from scss.extension.fonts import FontsExtension @@ -128,6 +129,7 @@ class Scss(object): ExtraExtension, FontsExtension, Namespace(functions=COMPASS_LIBRARY), + BootstrapExtension, ], search_path=search_paths, live_errors=self.live_errors, |