JohnCoene / javascript-for-r-comments

1 stars 0 forks source link

href vs src #22

Open MayaGans opened 3 years ago

MayaGans commented 3 years ago

Just a suggestion but since you mention using an href instead of src maybe include that as a comment in the code chunk below?

path <- system.file("htmlwidgets/stats", package = "gio")
  dep <- htmltools::htmlDependency(
    name = "stats",
    version = "17",
    src = c(file = path),
    # or:
    # src = c(href = "blah") or something?
    script = "stats.min.js"
  )
JohnCoene commented 3 years ago

Ah.

Let me ask for your advice here.

I use href over src for two reasons. 1) I want to keep things somewhat concise and not have to details "download the dependency, place it here in the package, ....", and 2) just show that href is doable.

I personally always advocate for download dependencies as I believe it produces more robust packages (what if someone changes that CDN dependency? what if I want to dev offline?).

I write that asking for your advice but as I do I realise I probably should not do any of the above? haha

MayaGans commented 3 years ago

Of course it's up to you, I get why downloading is probably better than a CDN but I was just thinking it'd be nice to see both ways written out