From 43f2dff179a3c2ec77d9198661b1d744e800c9ea Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 19 Mar 2013 16:44:33 +0100 Subject: [PATCH] [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 --- addons/web/controllers/main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 8caf92d69a5..a199cba7854 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -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)