diff --git a/flaskr/__init__.py b/flaskr/__init__.py index 089524d..00c7092 100644 --- a/flaskr/__init__.py +++ b/flaskr/__init__.py @@ -17,10 +17,10 @@ def optimize_css(): static_dir = root + '/undercover/flaskr/static/' css = open(static_dir + 'styles.css', 'r').read() minified_with_comments = "".join(list(map( - lambda line: line if 'media' in line or 'padding' in line or 'transition' in line else line.replace(' ', ''), + lambda line: re.sub(r':\s*', ':', re.sub(r'^\s*', '', line)), css.split('\n') ))) - minified = re.sub( r'/\*[\s\S]*?\*/', "", minified_with_comments) + minified = re.sub(r'/\*[\s\S]*?\*/', "", minified_with_comments) minified_file = open(static_dir + 'styles_min.css', 'w') minified_file.write(minified) minified_file.close()