theming-tools: add change:theme scripts

This commit is contained in:
Thomas Jund 2021-09-08 10:57:37 +02:00
parent b52561f2e4
commit 168fb7e884
3 changed files with 32 additions and 1 deletions

5
change-theme.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
source ~/envs/publik-env-py3/bin/activate
hobo-manage tenant_command runscript ~/src/misc-tjund/hobo-change-theme.py -d hobo.dev.publik.love --theme $1
deactivate

25
hobo-change-theme.py Normal file
View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
#
# Change Publik theme
#
# Usage:
# --theme THEME -- theme to shot (substring match)
#
# Example:
# hobo-manage tenant_command runscript hobo-change-theme.py -d hobo.dev.publik.love --theme new-theme-id
#
from hobo.theme.utils import get_selected_theme, set_theme
from hobo.deploy.signals import notify_agents
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--theme', dest='theme', type=str)
args = parser.parse_args()
theme_id = args.theme
if get_selected_theme() != theme_id:
set_theme(theme_id)
notify_agents(None)
print(get_selected_theme())

View File

@ -17,12 +17,13 @@
"scripts": {
"explore:css": "cd $npm_package_config_themefolder && postcss static/**/style.css --config postcss.config.js --dir /tmp/ > /tmp/explorecss.txt",
"stop:memcache": "sudo systemctl stop memcached",
"change:theme": "bash misc-tjund/change-theme.sh $npm_package_config_theme",
"build:css": "cd $npm_package_config_themefolder && make static/$npm_package_config_theme/style.css",
"build:themes": "cd $npm_package_config_themefolder && make themes.json",
"watch:scss": "cd $npm_package_config_themefolder && chokidar 'static/**/*.scss' -c 'npm run build:css'",
"watch:config": "cd $npm_package_config_themefolder && chokidar 'static/**/config.json' -c 'npm run build:themes'",
"serve": "node npm_serve.js",
"dev": "run-p watch:* & npm run serve"
"dev": "npm run change:theme && run-p watch:* & npm run serve"
},
"devDependencies": {
"browser-sync": "^2.26.7",