[FIX] base: also add vendor prefixes with debug=assets

As explained here: https://github.com/odoo/odoo/commit/770aec399c4e6e29cfc5854318cbda19a605315d#diff-3d7991d8bc534e0372f0bd9b4f9165a7R424,
we have to post-process the generated css to add some vendor prefixes.

Doing that there was however only adding those in non-debug=assets
files.
This commit is contained in:
qsm-odoo
2018-08-02 09:55:20 +02:00
parent a070c2e877
commit 8b1d17fe0e
+13 -11
View File
@@ -419,16 +419,7 @@ class AssetsBundle(object):
except psycopg2.Error:
pass
css_content = '\n'.join(asset.minify() for asset in self.stylesheets)
# Post process the produced css to add required vendor prefixes here
css_content = re.sub(r'(appearance: (\w+);)', r'-webkit-appearance: \2; -moz-appearance: \2; \1', css_content);
css_content = re.sub(r'(display: ((?:inline-)?)flex((?: ?!important)?);)', r'display: -webkit-\2flex\3; \1', css_content) # For PhantomJS tests
css_content = re.sub(r'(flex-flow: (\w+ \w+);)', r'-webkit-flex-flow: \2; \1', css_content) # For PhantomJS tests
css_content = re.sub(r'(flex: (\d+ \d+ (?:\d+|auto));)', r'-webkit-flex: \2; \1', css_content) # For PhantomJS tests
return css_content
return '\n'.join(asset.minify() for asset in self.stylesheets)
def compile_css(self, compiler, source):
"""Sanitizes @import rules, remove duplicates @import rules, then compile"""
@@ -450,12 +441,23 @@ class AssetsBundle(object):
return ''
source = re.sub(self.rx_preprocess_imports, sanitize, source)
compiled = ''
try:
compiled = compiler(source)
return compiled.strip()
except CompileError as e:
return handle_compile_error(e, source=source)
compiled = compiled.strip()
# Post process the produced css to add required vendor prefixes here
compiled = re.sub(r'(appearance: (\w+);)', r'-webkit-appearance: \2; -moz-appearance: \2; \1', compiled);
compiled = re.sub(r'(display: ((?:inline-)?)flex((?: ?!important)?);)', r'display: -webkit-\2flex\3; \1', compiled) # For PhantomJS tests
compiled = re.sub(r'(flex-flow: (\w+ \w+);)', r'-webkit-flex-flow: \2; \1', compiled) # For PhantomJS tests
compiled = re.sub(r'(flex: (\d+ \d+ (?:\d+|auto));)', r'-webkit-flex: \2; \1', compiled) # For PhantomJS tests
return compiled
def get_preprocessor_error(self, stderr, source=None):
"""Improve and remove sensitive information from sass/less compilator error messages"""
error = misc.ustr(stderr).split('Load paths')[0].replace(' Use --trace for backtrace.', '')