diff --git a/Makefile b/Makefile index 8020476..538ccd5 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,21 @@ NAME="rouen-publik-theme" prefix = /usr -all: css +all: themes.json css + +themes.json: $(wildcard static/*/config.json) + python publik-base-theme/create_themes_json.py --overlay rouen + +%.css: export LC_ALL=C.UTF-8 +.SECONDEXPANSION: +%.css: %.scss $$(wildcard $$(@D)/*.scss) + sass $< $@ publik-base-theme/static/includes/_data_uris.scss: $(wildcard publik-base-theme/static/includes/img/*) cd publik-base-theme; python make_data_uris.py static/includes/ -css: publik-base-theme/static/includes/_data_uris.scss $(wildcard static/rouen/*.scss) - cd static/rouen/ && sass style.scss:style.css - rm -rf static/rouen/.sass-cache/ +css: publik-base-theme/static/includes/_data_uris.scss $(shell python get_themes.py) + rm -rf static/*/.sass-cache/ clean: rm -rf sdist @@ -18,9 +25,10 @@ clean: rm -rf sdist publik-base-theme/static/includes/_data_uris.scss DIST_FILES = \ - Makefile static\ - templates themes.json \ - publik-base-theme + Makefile \ + publik-base-theme \ + static templates \ + get_themes.py dist: clean -mkdir sdist @@ -35,6 +43,7 @@ install: cp -r static templates themes.json $(DESTDIR)$(prefix)/share/publik/themes/rouen dist-bzip2: dist + -mkdir sdist cd sdist && tar cfj ../sdist/$(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION) version: diff --git a/get_themes.py b/get_themes.py new file mode 100644 index 0000000..aa64164 --- /dev/null +++ b/get_themes.py @@ -0,0 +1,9 @@ +#! /usr/bin/env python + +import os + +for dirname in sorted(os.listdir('static')): + config = os.path.join('static', dirname, 'config.json') + if not os.path.exists(config): + continue + print 'static/%s/style.css' % dirname diff --git a/static/rouen/config.json b/static/rouen/config.json new file mode 100644 index 0000000..3052ef6 --- /dev/null +++ b/static/rouen/config.json @@ -0,0 +1,6 @@ +{ + "label": "Rouen", + "variables": { + "theme_color": "#EE787C" + } +} diff --git a/themes.json b/themes.json deleted file mode 100644 index 539ab5c..0000000 --- a/themes.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - {"id": "rouen", - "label": "Rouen", - "overlay": "rouen", - "variables": { - "css_variant": "rouen", - "no_extra_js": true, - "theme_color": "#EE787C" - }, - "module": "publik-base" - } -]