Flutter-Bounty-Hunters / static_shock

A static site generator for Dart.
MIT License
58 stars 5 forks source link

[CLI] - Automate template updates #118

Open matthew-carroll opened 1 month ago

matthew-carroll commented 1 month ago

Templates in static_shock_cli have three pieces.

  1. A runnable project that represents the structure of a template, but with runnable values.
  2. A templated project, which is the same as #1 but with Mustache variables instead of real values.
  3. A template bundle file, which is packaged with the CLI source, and is inflated at runtime.

Updating a template requires:

  1. Update the runnable project to make sure things work as expected.
  2. Copy the modified files over to the templated project.
  3. Replace all Jinja syntax with escaped Mustache syntax, e.g., {{ -> {{#mustacheCase}}.
  4. Replace all hard-coded template values with Mustache varaibles.
  5. Run mason bundle.
  6. Move the bundle file to its final location in source code.

This process is incredibly tedious. It's easy to miss a Jinja {{ or }} and end up bundling a bad template. It's tedious to repeatedly replace the hard-coded values with Mustache variables for Mason.

Find a way to automate as much of this as possible to avoid mistakes.