ionide / Fornax

Scriptable static site generator using type safe F# DSL to define page templates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fornax Scripts/Extensions

oluwandabira opened this issue · comments

Is your feature request related to a problem? Please describe.
I would like to be able to extend fornax functionality with my owns scripts that are sort of meta generators, so I can do stuff like fornax newpost posts/hello and have the script make a the file filled with a basic front matter or fornax check to verify that configured generator and loader scripts actually have the appropriate functions without having Fornax build files halfway.

Describe the solution you'd like
Config is extended to have a ScriptConfig list (ScriptConfig contains a command and script filename) .

The actual script would need to have a function with signature run (projectRoot : string ) (config : Config) (args : string list ??) (result : Result<string, ScriptError> )

So say we have a ScriptConfig {command="newpost"; script="newpost.script"} and run fornax newpost posts/hello Fornax would evaluate the script (located in the scripts directory) passing along the appropriate arguments.

Describe alternatives you've considered
Running dotnet fsi check.fsx but using this would a be lot more work for the script to be aware of Fornax stuff.

Additional context
Got the idea while looking through #67 and thought that having Fornax as an extensible engine would be nice.