kopia lustrzana https://github.com/rtts/django-simplecms
Reduce indentation
rodzic
43c4cd281c
commit
3c8d5f6afe
|
@ -32,17 +32,16 @@ class SassMiddleware:
|
|||
css_file = request.path.rsplit('/',1)[1]
|
||||
sass_file = css_file[:-4]
|
||||
sass_paths = locate(sass_file)
|
||||
if sass_paths:
|
||||
for sass_path in sass_paths:
|
||||
if os.path.exists(sass_path):
|
||||
css_path = sass_path + '.css'
|
||||
map_path = css_path + '.map'
|
||||
css = compile(filename=sass_path, output_style='nested')
|
||||
css, mapping = compile(filename=sass_path, source_map_filename=map_path)
|
||||
with open(css_path, 'w') as f:
|
||||
f.write(css)
|
||||
with open(map_path, 'w') as f:
|
||||
f.write(mapping)
|
||||
for sass_path in list(sass_paths):
|
||||
if os.path.exists(sass_path):
|
||||
css_path = sass_path + '.css'
|
||||
map_path = css_path + '.map'
|
||||
css = compile(filename=sass_path, output_style='nested')
|
||||
css, mapping = compile(filename=sass_path, source_map_filename=map_path)
|
||||
with open(css_path, 'w') as f:
|
||||
f.write(css)
|
||||
with open(map_path, 'w') as f:
|
||||
f.write(mapping)
|
||||
|
||||
response = self.get_response(request)
|
||||
return response
|
||||
|
|
Ładowanie…
Reference in New Issue