loreanvictor / tmplr

Automate Code Scaffolding
MIT License
27 stars 0 forks source link

Add an expression for reading contents of files #4

Closed loreanvictor closed 1 year ago

loreanvictor commented 1 year ago

This can be used to include some files within each other, better yet to conditionally include sections and what not:

# .tmplr.yml
steps:
  - if: some_condition
    read: header
    from file: ./_some_case.md
    else:
      read: header
      from file: ./_some_other_case.md

  - update: README.md
<!-- README.md -->

{{ tmplr.header }}

# Some other stuff

Ha ha ho ho
loreanvictor commented 1 year ago

Similar to the proposed write command, this command could also support reading special values from JSON / YAML files.

read: some_variable
from file: conf.json
at: /path/to/key
loreanvictor commented 1 year ago

resolved via 8ce8644