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

feat: Update export command to use --template-dir and --template-param #32

Merged
merged 5 commits into from
Jul 1, 2024

Conversation

gadenbuie
Copy link
Contributor

@gadenbuie gadenbuie commented Jun 28, 2024

Pairs with posit-dev/shinylive#144
Helps with posit-dev/shinylive#110

This PR adds template_dir and template_params to shinylive.export() and as command line arguments in shinylive export.

  • template_dir or --template-dir allows users to customize the index.html file used by the exported app. This argument takes a path that, effectively, supercedes the path in the shinylive assets.
  • template_params or --template-params takes a dict of template parameters (in Python) or a JSON string or path to JSON in the CLI. https://github.com/posit-dev/shinylive/pull/144/files introduces a new set of template params, e.g. {{ title }}. This argument also covers parameters introduced by custom templates, or future parameters added to the default shinylive template.

We now also use mustache for templating via chevron to render the templates. In addition to being a more powerful templating engine, this also allows us to use the same template logic for both R and Python. chevron appears to be under-maintained but stable and recommended from the mustache frontpage.

…aram`

We now also use mustache via pystache to render the templates.
In addition to being a more powerful templating engine,
this also allows us to use the same template logic for both
R and Python.
setup.cfg Outdated Show resolved Hide resolved
shinylive/_utils.py Outdated Show resolved Hide resolved
shinylive/_utils.py Outdated Show resolved Hide resolved
shinylive/_app_json.py Outdated Show resolved Hide resolved
@gadenbuie gadenbuie merged commit ef36c98 into main Jul 1, 2024
6 checks passed
@gadenbuie gadenbuie deleted the feat/update-export-template branch July 1, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants