Question

I have the following config.yml file:

dygraphs:
  jshead: [js/dygraph-combined.js, js/lodash.js]
  cdn:
    jshead:
      - "http://cdnjs.cloudflare.com/ajax/libs/dygraph/1.0.1/dygraph-combined.js"
      - "http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"

It currently sources from the locally saved js/dygraph-combined.js and js/lodash.js files within my working directory.

How to rewrite it to source instead from the http addresses provided above?

EDIT

I've found a workaround without using config.yml, by inserting the addresses inside the rCharts object property like this:

dy1 <- rCharts$new()
...
dy1$html_assets$js = c(
 "http://cdnjs.cloudflare.com/ajax/libs/dygraph/1.0.1/dygraph-combined.js", 
 "http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js")
...

This will result in html file that indeed contains the remote resources:

<script src='http://cdnjs.cloudflare.com/ajax/libs/dygraph/1.0.1/dygraph-combined.js' type='text/javascript'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js' type='text/javascript'></script>

Is there still a way how to achieve the same by amending the config.yml file appropriately?

Was it helpful?

Solution

Posting my comment as an answer.

You can pass the option cdn = TRUE to the show or save methods and it will automatically make use of the http links. For example,

# display chart using http links
dy1$show(cdn = TRUE) 
# save chart using http links
dy1$save('mychart.html', cdn = TRUE)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top