statiqdev / Statiq.Web

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

Theme extensibility #891

Closed daveaglick closed 2 years ago

daveaglick commented 4 years ago

Been thinking about how to let theme change settings or even include their own modules or extensions and finally have a scheme I'm happy with.

daveaglick commented 4 years ago

Might need to back off the compilation idea :(. There's an ordering problem. If theme paths can be defined via settings and/or the bootstrapper, then by the time we've figured out the theme paths it's too late to load new assemblies and manipulate the bootstrapper from them.

I think the best we can do, at least for now, is allow a variety of appsettings.json etc. files in the theme root. Those will still need to be loaded late, but we can manually merge them with the actual settings. And with computed values now, they can do almost anything a compiled project could do (could even look at letting settings files add pipelines, etc.)

daveaglick commented 2 years ago

Ended up hacking around the ordering limitations described above. Essentially, I moved the file system to be independent of the engine and then split the theme initialization into stages. Themes can now have project files that get compiled and included during execution.