Skip to content

Commit c43590c

Browse files
get offline=FALSE working again
1 parent bfc7fd3 commit c43590c

File tree

7 files changed

+42
-46
lines changed

7 files changed

+42
-46
lines changed

R/dependencies.R

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#' library(reactR)
1313
#' library(htmltools)
1414
#'
15-
#' attachDependencies(
15+
#' tagList(
1616
#' tags$script(
1717
#' "
1818
#' ReactDOM.render(
@@ -25,7 +25,7 @@
2525
#' )
2626
#' "
2727
#' ),
28-
#' html_dependency_react()
28+
#' html_dependency_react() #offline=FALSE for CDN
2929
#' )
3030
html_dependency_react <- function(offline=TRUE){
3131
hd <- htmltools::htmlDependency(
@@ -36,11 +36,12 @@ html_dependency_react <- function(offline=TRUE){
3636
)
3737

3838
if(!offline) {
39-
hd$src <- list(href=sprintf(
40-
"//unpkg.com/react/@%s/",
41-
react_version()
42-
))
43-
hd$script = c("react.production.min.js", "react-dom.production.min.js")
39+
hd$src <- list(href="//unpkg.com")
40+
41+
hd$script <- c(
42+
"react/umd/react.production.min.js",
43+
"react-dom/umd/react-dom.production.min.js"
44+
)
4445
}
4546

4647
hd

docs/articles/index.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/intro_reactR.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/html_dependency_react.html

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/index.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/examples/blueprint.R

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ blueprint <- htmlDependency(
1414

1515
# make sure we have dependencies as expected
1616
# by adding react and blueprint to empty tagList
17-
tagList() %>>%
18-
attachDependencies(
19-
list(html_dependency_react(offline=FALSE), blueprint)
20-
) %>>%
17+
tagList(
18+
html_dependency_react(offline=FALSE),
19+
html_dependency_reactdom(offline=FALSE),
20+
blueprint
21+
) %>>%
2122
browsable()
2223

2324

@@ -55,20 +56,17 @@ ReactDOM.render(tbl, document.querySelector("#app-table"));
5556
)
5657
)
5758
)
58-
)
59-
)%>>%
60-
attachDependencies(
61-
list(
62-
htmlDependency(
63-
name="classnames",
64-
version="2.2.5",
65-
src = c(href="https://unpkg.com/classnames"),
66-
script = ""
67-
),
68-
html_dependency_react(offline=FALSE),
69-
blueprint
70-
)
71-
) %>>%
59+
),
60+
htmlDependency(
61+
name="classnames",
62+
version="2.2.5",
63+
src = c(href="https://unpkg.com/classnames"),
64+
script = ""
65+
),
66+
html_dependency_react(),
67+
html_dependency_reactdom(),
68+
blueprint
69+
) %>>%
7270
browsable()
7371

7472

@@ -93,18 +91,15 @@ ReactDOM.render(tbl, document.querySelector('#app-table'));
9391

9492
)
9593
)
96-
)
97-
)%>>%
98-
attachDependencies(
99-
list(
100-
htmlDependency(
101-
name="classnames",
102-
version="2.2.5",
103-
src = c(href="https://unpkg.com/classnames"),
104-
script = ""
105-
),
106-
html_dependency_react(offline=FALSE),
107-
blueprint
108-
)
109-
) %>>%
94+
),
95+
htmlDependency(
96+
name="classnames",
97+
version="2.2.5",
98+
src = c(href="https://unpkg.com/classnames"),
99+
script = ""
100+
),
101+
html_dependency_react(),
102+
html_dependency_reactdom(),
103+
blueprint
104+
) %>>%
110105
browsable()

man/html_dependency_react.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)