Themes
Themes are more than just a way to customize a site looks.
A theme can provide:
- Template files
- Static files
- A configuration interface
- An example site
- A function library
A theme can be extended by another, and multiple themes can be combined together.
Basics
Themes are declared in site.nix
. Local themes are used by proving a path, but is possible to use remote themes, like themes of the styx-themes
directly.
To use a themes, it is just required to add it to the themes
list:
themes = [
styx-themes.generic-templates
./themes/my-theme
];
Themes at the beginning of the list have lower priority.
In this example, the styx-themes.generic-templates
is combined with the ./themes/my-theme
theme.
Example sites
Themes of the styx-themes
package provide an example site that can be previewed locally by running a single command:
$ styx preview-theme showcase
The list of themes in the styx-themes
set can be listed with the following command:
$ styx preview-theme
Please select a theme, available themes are:
- agency
- generic-templates
- ghostwriter
- hyde
- nix
- orbit
- showcase
Configuration interface
A theme can provide many configuration options that can be used to customize it.
These configuration options can be used and changed in the site conf.nix
. An interesting feature is that these options can be typed, and if they are styx will automatically do a type check when building a site.
Documentation
Themes that are part of the styx-themes
are documented in the styx documentation that can be launched with the following command:
$ styx doc
It is also possible to generate a documentation for the themes used in a site. In site root run the following command:
$ styx site-doc