More precise CSS optimization.
This commit is contained in:
parent
784ba35f36
commit
76a61f69e0
|
@ -17,7 +17,7 @@ def optimize_css():
|
||||||
static_dir = root + '/undercover/flaskr/static/'
|
static_dir = root + '/undercover/flaskr/static/'
|
||||||
css = open(static_dir + 'styles.css', 'r').read()
|
css = open(static_dir + 'styles.css', 'r').read()
|
||||||
minified_with_comments = "".join(list(map(
|
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')
|
css.split('\n')
|
||||||
)))
|
)))
|
||||||
minified = re.sub(r'/\*[\s\S]*?\*/', "", minified_with_comments)
|
minified = re.sub(r'/\*[\s\S]*?\*/', "", minified_with_comments)
|
||||||
|
|
Loading…
Reference in New Issue