[FIX] remove existing sourcemaps in CSS files

bzr revid: xmo@openerp.com-20140417142012-mhi8saeofkon5pe5
This commit is contained in:
Xavier Morel 2014-04-17 16:20:12 +02:00
parent f8964db435
commit 5b081731cc
1 changed files with 7 additions and 6 deletions

View File

@ -1077,6 +1077,7 @@ class StylesheetAsset(WebAsset):
rx_import = re.compile(r"""@import\s+('|")(?!'|"|/|https?://)""", re.U)
rx_url = re.compile(r"""url\s*\(\s*('|"|)(?!'|"|/|https?://|data:)""", re.U)
rx_comments = re.compile(r"""/\*.*\*/""", re.S)
rx_sourceMap = re.compile(r'(/\*# sourceMappingURL=.*)', re.U)
def _get_content(self):
if self.source:
@ -1099,21 +1100,21 @@ class StylesheetAsset(WebAsset):
if self.url:
web_dir = os.path.dirname(self.url)
content = re.sub(
self.rx_import,
content = self.rx_import.sub(
r"""@import \1%s/""" % (web_dir,),
content,
)
content = re.sub(
self.rx_url,
content = self.rx_url.sub(
r"url(\1%s/" % (web_dir,),
content,
)
return content
# def minify(self):
# return self.rx_comments.sub('', self.content)
def minify(self):
# remove existing sourcemaps, make no sense after re-mini
return self.rx_sourceMap.sub('', self.content)
# return self.rx_comments.sub('', self.content)
def rjsmin(script):
""" Minify js with a clever regex.