forked from chaos-nah/merch
No description
- Jinja 36.4%
- CSS 32.7%
- SCSS 14.6%
- Python 9%
- JavaScript 7%
- Other 0.2%
How to add a new event
- add new models to
data/models.json- add the datasheets to
datasheets/
- add the datasheets to
- add all products to a new event-file
data/events/<eventname>.json- add product photos to
images/
- add product photos to
- (optional) add a custom theme to
style/<eventname>.css- for further information see
style/example_event.css
- for further information see
Build project
Generate static files
uv sync
./build.sh
Manage translations in locales/
To search for new translation strings in the templates run
uv run pybabel extract -F babel.cfg -o locales/messages.pot .
uv run pybabel update -i locales/messages.pot -d locales
To compile the translation files run
uv run pybabel compile -d locales
Adaptive privacy policy with caddy
The privacy policy page can adapt to the domain it is hosted on, when you enable caddy templating for it.
You have to set the variable privacy_mode to one of the following values:
- main (no proxy, main instance)
- cname (no proxy, only DNS CNAME delegation)
- proxy (proxy, traffic comes from another server)
See Caddyfile.example.proxy for an example on how to use this for a proxied domain:
vars privacy_mode "proxy"@privacy path /de/privacy/* /en/privacy/*
handle @privacy {
root * /srv
templates
file_server
}
Tooling
For development and generating useful diffs, a consistent code style is important. That is why we use the following formatters for the specified languages:
- HTML, CSS, SCSS, JavaScript, JSON: prettier
- JSON & SCSS with a line length of 120 chars
- All other files: default settings
- Jinja2 Templates: djLint
uv run djlint ./templates/ --extension=html.j2 --reformat
- Python: black
- Default settings
- We decided to keep the default 88 chars per line instead of PEP8's 79
To compile SCSS into CSS we use dart-sass in its default settings (that is, expanded style) based on the prettier-formatted SCSS file.