statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.
https://statiq.dev/web
Other
1.65k stars 235 forks source link

Themes need a way to manipulate pipelines #485

Open daveaglick opened 7 years ago

daveaglick commented 7 years ago

Some themes may come with special or different features. For example, it's common in Jekyll for themes to have totally different functionality (in that world a theme is almost like a recipe).

Wyam themes need a way to manipulate the engine and pipelines. This should probably happen after the recipe is applied and before the configuration file is processed.

Not sure about the implementation of this feature. Perhaps this is related to addins in #370 - maybe if a theme package has addins they should be automatically added? Maybe a theme should declare what addins it uses and the corresponding packages?

elvogel commented 7 years ago

If a theme has addins, they should automatically add them for sure. Ideally, themes would let you know what they are adding in before you use them if only to help the end user master the theme a little faster; themes should also have a way of helping the end user navigate through the implementation.

daveaglick commented 7 years ago

After thinking this over and doing some theme work, this should be based on #228. I really like the way Hugo themes can just be copied to the theme folder and want to maintain that behavior. I don't want NuGet to be a prerequisite for any type of theme, including those that manipulate the pipelines.

To allow themes to edit the runtime environment I'm thinking if we find a theme.wyam file (or some similar name) at the root as propagated through the aggregated virtual file system, then it gets evaluated like a config file in a pass after the recipe but before the normal config file (so any theme behavior can still be tweaked by the user).

Note that like the normal config file, this theme config file would also get ignored during embedded use and it'll be up to the embedded engine caller to process it using Wyam.Configuration if they want to (might add a note about this to the embedded usage docs).