-
DescriptionThis is probably such a noob question but... How can we load functions in an external file so that they are available at render-time for a quarto doc? Say I have this sayGoodbye = function(x) {
return 1 - x;
} And then I have this quarto doc:
These all failed at the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 16 replies
-
To note this is unrelated to Quarto. This being said, here is an example:
Edit: from the documentation https://quarto.org/docs/interactive/ojs/code-reuse.html#modules |
Beta Was this translation helpful? Give feedback.
@boshek one issue here is that OJS doesn't work well with
self-contained: true
, exactly because of javascript imports.You'll find that the following works:
myModule.js:
However, you will need to serve this page from a http or https server (instead of the local file:// scheme), because javascript module imports are only supported in the http and https protocols.