Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a templating engine for Spin templates #15

Closed
radu-matei opened this issue Jan 26, 2022 · 0 comments
Closed

Use a templating engine for Spin templates #15

radu-matei opened this issue Jan 26, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request P0
Milestone

Comments

@radu-matei
Copy link
Member

The current implementation for templates is rather simple:

❯ spin templates add --help
spin-templates-add 0.1.0
Add a template repository locally

USAGE:
    spin templates add [OPTIONS] --name <name>

OPTIONS:
        --branch <branch>    The optional branch of the git repository
        --git <git>          The URL of the templates git repository. The templates must be in a git repository in a
                             "templates" directory
        --local <local>      Local directory to add as a template
        --name <name>        The name of the templates repository

Templates can added from:

  • a git repository with a templates/ directory in the root, containing individual templates as directories
  • a single local directory

While they are named "templates", there is no templating engine configured, and creating a new application based on a template using spin new will simply copy the contents of the selected "template".
There are a few options for selecting a templating engine - for example, yo-wasm uses EJS, while cargo generate uses the Liquid template language.

(One very interesting approach of cargo generate is allowing template-defined placeholders, which allow for template authors to define custom variables and either get their values through user interaction, or use a supplied default value.)

Ideally, we would pick a templating language and implement support for it with Spin templates.

@radu-matei radu-matei added the enhancement New feature or request label Jan 26, 2022
@radu-matei radu-matei added this to the v0.1.0 milestone Feb 7, 2022
@radu-matei radu-matei added the P0 label Feb 7, 2022
@fibonacci1729 fibonacci1729 self-assigned this Feb 28, 2022
@radu-matei radu-matei modified the milestones: v0.1.0, v0.2.0 Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P0
Projects
None yet
Development

No branches or pull requests

2 participants