Skip to content

Commit 004bbf5

Browse files
committed
fix dependency handling
1 parent 088bae3 commit 004bbf5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

R/utils.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ get_assets <- function(p) {
235235
deps <- list(NULL)
236236
# if there are any geo trace(s), add the geo assets dependency
237237
if (any(grepl("geo|choropleth", types))) {
238-
deps[[1]] <- plotly_dist("geo")
238+
deps <- c(deps, plotly_dist("geo"))
239239
}
240240
if (isTRUE(p$config$mathjax)) {
241-
deps[[2]] <- plotly_dist("mathjax")
241+
deps <- c(deps, plotly_dist("mathjax"))
242242
}
243243
deps
244244
}
@@ -260,12 +260,13 @@ plotly_dist <- function(extra = c("mathjax", "geo")) {
260260
pat <- 'MathJax.fileversion="[0-9]+.[0-9]+.[0-9]+'
261261
ver <- regmatches(mathjax, regexpr(pat, mathjax))
262262
ver <- sub('"', '', strsplit(ver, "=")[[1]][2])
263-
htmltools::htmlDependency(
263+
dep <- htmltools::htmlDependency(
264264
name = "mathjax",
265265
version = ver,
266266
src = dirname(mj),
267267
script = basename(mj)
268268
)
269+
return(list(dep))
269270
}
270271
}
271272
if (extra[1] == "geo") {
@@ -279,12 +280,13 @@ plotly_dist <- function(extra = c("mathjax", "geo")) {
279280
} else {
280281
geo <- file.path(path, "dist", "plotly-geo-assets.js")
281282
if (!file.exists(geo)) stop("Couldn't locate plotly-geo-assets.js")
282-
htmltools::htmlDependency(
283+
dep <- htmltools::htmlDependency(
283284
name = "plotly-geo-assets",
284285
src = dirname(geo),
285286
version = "1.0",
286287
script = basename(geo)
287288
)
289+
return(list(dep))
288290
}
289291
}
290292
}

0 commit comments

Comments
 (0)