theming-tools: add change:theme scripts
This commit is contained in:
parent
b52561f2e4
commit
168fb7e884
|
@ -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
|
|
@ -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())
|
|
@ -17,12 +17,13 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"explore:css": "cd $npm_package_config_themefolder && postcss static/**/style.css --config postcss.config.js --dir /tmp/ > /tmp/explorecss.txt",
|
"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",
|
"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:css": "cd $npm_package_config_themefolder && make static/$npm_package_config_theme/style.css",
|
||||||
"build:themes": "cd $npm_package_config_themefolder && make themes.json",
|
"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: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'",
|
"watch:config": "cd $npm_package_config_themefolder && chokidar 'static/**/config.json' -c 'npm run build:themes'",
|
||||||
"serve": "node npm_serve.js",
|
"serve": "node npm_serve.js",
|
||||||
"dev": "run-p watch:* & npm run serve"
|
"dev": "npm run change:theme && run-p watch:* & npm run serve"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"browser-sync": "^2.26.7",
|
"browser-sync": "^2.26.7",
|
||||||
|
|
Loading…
Reference in New Issue