[FIX] web: correct the concatenation of css files: @charset and @import rules must be before any other rules

bzr revid: chs@openerp.com-20130319154433-zizwv4irfvh93swe
This commit is contained in:
Christophe Simonis 2013-03-19 16:44:33 +01:00
parent d2076aece3
commit 43f2dff179
1 changed files with 12 additions and 0 deletions

View File

@ -638,6 +638,18 @@ class WebClient(openerpweb.Controller):
content, checksum = concat_files((f[0] for f in files), reader)
# move up all @import and @charset rules to the top
matches = []
def push(matchobj):
matches.append(matchobj.group(0))
return ''
content = re.sub(re.compile("(@charset.+;$)", re.M), push, content)
content = re.sub(re.compile("(@import.+;$)", re.M), push, content)
matches.append(content)
content = '\n'.join(matches)
return make_conditional(
req, req.make_response(content, [('Content-Type', 'text/css')]),
last_modified, checksum)