If you want to dig into the nitty gritty underbelly, this is the place.
Dragon works on stages:
- Synchronize — Scan files from root folder, copying plain files into build folder as necessary.
- PreEval — A stage plugins can be injected to do something before evaluation.
- Evaluation — Process all identified dragon/eex templates and Scss files, saving the result into the build folder.
- PostEval — After evaluation of each file plugins may be run to do additional work. Current plugins:
- Markdown -> Html — convert Markdown content to HTML
- Redirect links — generate redirecting files
- Postprocess — [WIP] Scan all files in build folder and validate/cleanup/minify as appropriate based on content type.
- Deploy — [Future] integration with deployment. First: S3 for CDN's
Dragon was initially build as an Escript application. However, Escript apps do not support NIFs (native compiled code), which is used by the Scss library, meaning we had to find another solution.
More detail on this eventually. But at a high level, just implement the Dragon.Plugin behavior (see the code) and reference your plugin in the dragon config.
For plugins beyond the standard included with Dragon, you'll need to run in a "Mix Project" mode rather than "Standalone" mode.