Commit d6acb9c4 by Tom 'Biwaa' Riat Committed by GitHub

Merge pull request #626 from vskh/master

Fix css url detector regex.
parents f78d3e01 2cdb72a7
...@@ -16,7 +16,7 @@ from pipeline.conf import settings ...@@ -16,7 +16,7 @@ from pipeline.conf import settings
from pipeline.exceptions import CompressorError from pipeline.exceptions import CompressorError
from pipeline.utils import to_class, relpath, set_std_streams_blocking from pipeline.utils import to_class, relpath, set_std_streams_blocking
URL_DETECTOR = r"""url\((['"]){0,1}\s*(.*?)["']{0,1}\)""" URL_DETECTOR = r"""url\((['"]?)\s*(.*?)\1\)"""
URL_REPLACER = r"""url\(__EMBED__(.+?)(\?\d+)?\)""" URL_REPLACER = r"""url\(__EMBED__(.+?)(\?\d+)?\)"""
NON_REWRITABLE_URL = re.compile(r'^(#|http:|https:|data:|//)') NON_REWRITABLE_URL = re.compile(r'^(#|http:|https:|data:|//)')
......
.embedded-url-svg {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E% 3C/svg%3E");
}
@font-face { @font-face {
font-family: 'Pipeline'; font-family: 'Pipeline';
src: url('../fonts/pipeline.eot'); src: url('../fonts/pipeline.eot');
......
...@@ -138,7 +138,10 @@ class CompressorTest(TestCase): ...@@ -138,7 +138,10 @@ class CompressorTest(TestCase):
output = self.compressor.concatenate_and_rewrite([ output = self.compressor.concatenate_and_rewrite([
_('pipeline/css/urls.css'), _('pipeline/css/urls.css'),
], 'css/screen.css') ], 'css/screen.css')
self.assertEqual("""@font-face { self.assertEqual(""".embedded-url-svg {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E% 3C/svg%3E");
}
@font-face {
font-family: 'Pipeline'; font-family: 'Pipeline';
src: url(../pipeline/fonts/pipeline.eot); src: url(../pipeline/fonts/pipeline.eot);
src: url(../pipeline/fonts/pipeline.eot?#iefix) format('embedded-opentype'); src: url(../pipeline/fonts/pipeline.eot?#iefix) format('embedded-opentype');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment