2018-09-23 09:26:59 +02:00
|
|
|
#! /usr/bin/env python
|
|
|
|
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
|
|
|
|
themes = []
|
|
|
|
for dirname in sorted(os.listdir('static')):
|
|
|
|
config = os.path.join('static', dirname, 'config.json')
|
|
|
|
if not os.path.exists(config):
|
|
|
|
continue
|
|
|
|
theme = json.load(open(os.path.join('static', dirname, 'config.json')))
|
|
|
|
theme['id'] = dirname
|
|
|
|
if not 'variables' in theme:
|
|
|
|
theme['variables'] = {}
|
|
|
|
if not theme['variables'].get('css_variant'):
|
|
|
|
theme['variables']['css_variant'] = dirname
|
2019-01-08 09:23:12 +01:00
|
|
|
if os.path.exists(os.path.join('static', dirname, 'extra.js')):
|
|
|
|
theme['variables']['no_extra_js'] = False
|
|
|
|
else:
|
|
|
|
theme['variables']['no_extra_js'] = True
|
2018-09-23 09:26:59 +02:00
|
|
|
themes.append(theme)
|
|
|
|
|
|
|
|
with open('themes.json', 'w') as fd:
|
|
|
|
json.dump(themes, fd, indent=2, sort_keys=True)
|