Closed Tutuchan closed 7 years ago
Bonjour Pierre I'm sorry but I don't have an answer for you. I wouldn't want to include moment by default, but I don't know how to solve your problem. This feels like a question that's general to htmlwidgets rather than specific to timevis, so perhaps you could try asking about this in the htmlwidgets repo? On Dec 29, 2016 6:04 AM, "Pierre Formont" notifications@github.com wrote:
Hi Dean and thanks for the great package.
I'd like to use it but with a French locale which is not natively supported by vis.js. It is possible to include moment.js with locales in the page in order to have locale support, which is great.
However, moment needs to be included before vis.js for this to work. So I tried several things:
- the easiest is to add moment-with-locales.min.js as the first dependency in timevis.yaml, which is what I've done locally but including a 280KB library for a specific use case seems overkill,
- I tried adding the dependency dynamically in timevis.R this way:
if (!is.null(options$locale)) { deps <- c( deps, list( htmltools::htmlDependency( name = "moment", version = "2.17.1", src = system.file("htmlwidgets/lib/moment-2.17.1", package = "timevis"), script = "moment-with-locales.min.js" ) ) ) }
which does not work because these dependencies are included after the ones in the YAML config file
- it's the same problem when trying to include it directly in a Shiny app with tags$head(tags$script(src = ...)), it is loaded after all the other dependencies
So do you have any ideas how to proceed from there ? Maybe updating the html_dependency structure from htmltools in order to include an include_before field ?
Thanks, Pierre
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/daattali/timevis/issues/21, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6IFNpOWeUM6hmAmApS-itK1rEo9wKGks5rM5OwgaJpZM4LXggf .
Thanks for your answer Dean, I'll open an issue on the htmlwidgets repo !
Feel free to link to this issue to show an example of your usecase On Dec 30, 2016 3:24 AM, "Pierre Formont" notifications@github.com wrote:
Closed #21 https://github.com/daattali/timevis/issues/21.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/daattali/timevis/issues/21#event-907929120, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6IFE3b08Iy5L6J1MsdHbXiXoQZ1BXVks5rNL-_gaJpZM4LXggf .
Hi Dean and thanks for the great package.
I'd like to use it but with a French locale which is not natively supported by
vis.js
. It is possible to includemoment.js
with locales in the page in order to have locale support, which is great.However,
moment
needs to be included beforevis.js
for this to work. So I tried several things:the easiest is to add moment-with-locales.min.js as the first dependency in timevis.yaml, which is what I've done locally but including a 280KB library for a specific use case seems overkill,
I tried adding the dependency dynamically in timevis.R this way:
which does not work because these dependencies are included after the ones in the YAML config file
it's the same problem when trying to include it directly in a Shiny app with
tags$head(tags$script(src = ...))
, it is loaded after all the other dependenciesSo do you have any ideas how to proceed from there ? Maybe updating the
html_dependency
structure from htmltools in order to include aninclude_before
field ?Thanks, Pierre