-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Customize export template and parameters (#96)
* refactor: Use glue to interpolate template parameters * feat(export): Add `template_dir` parameter * chore: rlang::use_import_from("rlang", "is_interactive') * feat(export): Add `template_params` parameter * fix: Throw an error if template uses a parameter without a value Otherwise `glue::glue()` will just return an empty string. This gives a much better and more focused error message. * fix: prefix is_interactive in examplesIf * fix: It's better just to emit an empty string for missing template parameters * tests: Add customized export template test * feat: switch to whisker (mustache) templating * feat: copy asset files from `template_dir` Treat `.html` files as templates for interpolation, and copy all other files as-is. * fix: includes may include raw HTML * docs: Add news item * chore: tweak news * tests: update tested `export_template/index.html` * chore: Align template variable names * chore: Add myself and George as authors * chore: usethis::use_tidy_description()
- Loading branch information
Showing
12 changed files
with
262 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,52 @@ | ||
Package: shinylive | ||
Title: Run 'shiny' Applications in the Browser | ||
Version: 0.1.1.9000 | ||
Authors@R: | ||
c( | ||
person("Barret", "Schloerke", , "[email protected]", role = c("aut", "cre"), | ||
Authors@R: c( | ||
person("Barret", "Schloerke", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "0000-0001-9986-114X")), | ||
person("Winston", "Chang", role = c("aut"), email = "[email protected]", comment = c(ORCID = "0000-0002-1576-2126")), | ||
person("George", "Stagg", role = "ctb", email = "[email protected]"), | ||
person("Posit Software, PBC", role = c("cph", "fnd")) | ||
) | ||
Description: Exporting 'shiny' applications with 'shinylive' allows you to run them entirely in a web browser, without the need for a separate R server. The traditional way of deploying 'shiny' applications involves in a separate server and client: the server runs R and 'shiny', and clients connect via the web browser. When an application is deployed with 'shinylive', R and 'shiny' run in the web browser (via 'webR'): the browser is effectively both the client and server for the application. This allows for your 'shiny' application exported by 'shinylive' to be hosted by a static web server. | ||
person("Winston", "Chang", , "[email protected]", role = "aut", | ||
comment = c(ORCID = "0000-0002-1576-2126")), | ||
person("George", "Stagg", , "[email protected]", role = "aut"), | ||
person("Garrick", "Aden-Buie", , "[email protected]", role = "aut", | ||
comment = c(ORCID = "0000-0002-7111-0077")), | ||
person("Posit Software, PBC", role = c("cph", "fnd")) | ||
) | ||
Description: Exporting 'shiny' applications with 'shinylive' allows you to | ||
run them entirely in a web browser, without the need for a separate R | ||
server. The traditional way of deploying 'shiny' applications involves | ||
in a separate server and client: the server runs R and 'shiny', and | ||
clients connect via the web browser. When an application is deployed | ||
with 'shinylive', R and 'shiny' run in the web browser (via 'webR'): | ||
the browser is effectively both the client and server for the | ||
application. This allows for your 'shiny' application exported by | ||
'shinylive' to be hosted by a static web server. | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.3.1 | ||
URL: https://posit-dev.github.io/r-shinylive/, | ||
https://github.com/posit-dev/r-shinylive | ||
BugReports: https://github.com/posit-dev/r-shinylive/issues | ||
URL: https://posit-dev.github.io/r-shinylive/, https://github.com/posit-dev/r-shinylive | ||
Imports: | ||
archive, | ||
brio, | ||
fs, | ||
glue, | ||
gh, | ||
glue, | ||
httr2 (>= 1.0.0), | ||
jsonlite, | ||
pkgdepends, | ||
progress, | ||
rappdirs, | ||
renv, | ||
rlang, | ||
tools | ||
tools, | ||
whisker | ||
Suggests: | ||
httpuv (>= 1.6.12), | ||
pkgcache, | ||
spelling, | ||
testthat (>= 3.0.0) | ||
Config/Needs/website: tidyverse/tidytemplate | ||
Config/testthat/edition: 3 | ||
Encoding: UTF-8 | ||
Language: en-US | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#' @keywords internal | ||
"_PACKAGE" | ||
|
||
## usethis namespace: start | ||
#' @importFrom rlang %||% | ||
#' @importFrom rlang is_interactive | ||
## usethis namespace: end | ||
NULL |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | ||
<head> | ||
<title>Redirect to editable app</title> | ||
<meta | ||
http-equiv="refresh" | ||
content="0;URL='../index.html?mode=editor-terminal-viewer'" | ||
/> | ||
</head> | ||
<body></body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>{{title}}</title> | ||
<meta name="description" content="{{ description }}"> | ||
<script | ||
src="./{{REL_PATH}}shinylive/load-shinylive-sw.js" | ||
type="module" | ||
></script> | ||
<script type="module"> | ||
import { runExportedApp } from "./{{REL_PATH}}shinylive/shinylive.js"; | ||
runExportedApp({ | ||
id: "root", | ||
appEngine: "{{APP_ENGINE}}", | ||
relPath: "{{REL_PATH}}", | ||
}); | ||
</script> | ||
<link rel="stylesheet" href="./{{REL_PATH}}shinylive/style-resets.css" /> | ||
<link rel="stylesheet" href="./{{REL_PATH}}shinylive/shinylive.css" /> | ||
{{{ include_in_head }}} | ||
</head> | ||
<body> | ||
{{{ include_before_body }}} | ||
<div style="height: 100vh; width: 100vw" id="root"></div> | ||
{{{ include_after_body }}} | ||
</body> | ||
</html> |
Oops, something went wrong.