30 Aug 2022: New theme structure
Changes:
- New theme structure
- Default theme's CSS is generated only during theme dev
- New config option:
:com.platypub/copy-theme-npm-deps
Just pushed a big update to platypub's default theme: https://github.com/jacobobryant/platypub/tree/master/themes/default
I have similarly updated biffweb.com's theme: https://github.com/jacobobryant/platypub-biffweb-theme
Now themes are structured as regular clojure/babashka projects with a deps.edn file, which means the code can be reused via deps.edn dependencies (local or git). For example, the biff site's theme reuses the default theme's config file, but exposes a different set of site settings:
- https://github.com/jacobobryant/platypub-biffweb-theme/blob/master/deps.edn
- https://github.com/jacobobryant/platypub-biffweb-theme/blob/master/src/com/biffweb/theme/config.clj
Also themes now use babashka tasks instead of ./render-site
and ./render-email
scripts (however platypub still checks for those for backwards compatibilite). See:
- https://github.com/jacobobryant/platypub/blob/master/themes/default/bb.edn
- https://github.com/jacobobryant/platypub-biffweb-theme/blob/master/bb.edn
This update should be fully backwards compatible; no need to update custom themes right away. But if you do hit a bug let me know.
Previously when Platypub called the default theme's ./render-site
command, the default theme would run tailwind to generate the main.css
file. This is slow in prod if you're running on a small server. Now we track the main.css
file in git. If you make changes to the default theme that result in a new css file, you'll have to ensure the updated main.css
is written and committed.
The new :com.platypub/copy-theme-npm-deps
option, if set to true
, instructs platypub to reuse the node_modules
folder whenever it renders the site instead of running npm install
each time. We started running npm install
each time because sometimes (always?) on Mac, using the same node_modules
folder in a different directory from where it was installed caused an error. However it seems to work fine on linux, and copying it is faster. I recommend setting the option to true
under the :prod
section in platypub's config.edn
file. If you run into problems in dev, set it to false
in the :dev
section.