Skip to content

Commit

Permalink
Restructure and reformat JavaScript assets (#653)
Browse files Browse the repository at this point in the history
Co-authored-by: Barret Schloerke <[email protected]>
  • Loading branch information
gadenbuie and schloerke authored Feb 3, 2022
1 parent b99922b commit 2b70b20
Show file tree
Hide file tree
Showing 29 changed files with 12,209 additions and 3,400 deletions.
9 changes: 9 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,12 @@ rsconnect/
^reference$
^pkgdown$
^_dev$
^learnr-js$
^node_modules$
^package\.json$
^package-lock\.json$
^\.browserslistrc$
^babel\.config\.json$
^\.eslintignore$
^\.vscode$
^inst/tutorials/*/*_files$
7 changes: 7 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Browsers that we support
last 2 versions
not dead
> 0.2%
Firefox ESR
phantomjs 2.1
IE 11 # kinda
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
inst/lib/*
inst/rmarkdown/templates/tutorial/resources/tutorial-format.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.vscode
Untitled
issues
node_modules

# atom config folder
.atom/
Expand Down
22 changes: 2 additions & 20 deletions R/html-dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,11 @@ tutorial_html_dependency <- function() {
version = utils::packageVersion("learnr"),
src = html_dependency_src("lib", "tutorial"),
script = "tutorial.js",
stylesheet = "tutorial.css"
stylesheet = "tutorial.css",
all_files = TRUE
)
}

tutorial_autocompletion_html_dependency <- function() {
htmltools::htmlDependency(
name = "tutorial-autocompletion",
version = utils::packageVersion("learnr"),
src = html_dependency_src("lib", "tutorial"),
script = "tutorial-autocompletion.js"
)
}

tutorial_diagnostics_html_dependency <- function() {
htmltools::htmlDependency(
name = "tutorial-diagnostics",
version = utils::packageVersion("learnr"),
src = html_dependency_src("lib", "tutorial"),
script = "tutorial-diagnostics.js"
)
}


html_dependency_src <- function(...) {
if (nzchar(Sys.getenv("RMARKDOWN_SHINY_PRERENDERED_DEVMODE"))) {
r_dir <- utils::getSrcDirectory(html_dependency_src, unique = TRUE)
Expand Down
4 changes: 1 addition & 3 deletions R/initialize.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ initialize_tutorial <- function() {
rmarkdown::html_dependency_font_awesome(),
bootbox_html_dependency(),
idb_html_dependency(),
tutorial_html_dependency(),
tutorial_autocompletion_html_dependency(),
tutorial_diagnostics_html_dependency()
tutorial_html_dependency()
))

# session initialization (forward tutorial metadata)
Expand Down
2 changes: 0 additions & 2 deletions R/tutorial-format.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ tutorial <- function(fig_width = 6.5,
# tutorial-format.js file.
extra_dependencies <- append(extra_dependencies, list(
tutorial_html_dependency(),
tutorial_autocompletion_html_dependency(),
tutorial_diagnostics_html_dependency(),
tutorial_i18n_html_dependency(language),
htmltools::htmlDependency(
name = "tutorial-format",
Expand Down
19 changes: 19 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"presets": [
[
"@babel/preset-env",
{
"modules": "auto",
"spec": true,
"useBuiltIns": "usage",
"forceAllTransforms": true,
"corejs": {
"version": "3.21",
"proposals": false
}
}
]
],
"comments": false
}

148 changes: 0 additions & 148 deletions design/Comments-for-JJ.Rmd

This file was deleted.

Loading

0 comments on commit 2b70b20

Please sign in to comment.