Skip to content

Commit a493dee

Browse files
authored
Add back requirejs for rendering julia and matlab plots
1 parent 701c86b commit a493dee

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

_includes/layouts/head.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,28 @@
4343
<!-- Plotly.js hardcoded to 1.x due to Plotly.plot() -->
4444
<script src="https://cdn.plot.ly/plotly-1.58.4.min.js"></script>
4545
<script src="/all_static/r_files/r_dependencies.js"></script>
46+
{% elsif page.language == "julia" or page.language == "matlab" %}
47+
<!-- Plotly.js hardcoded to 2.x for RequireJS/AMD compatibility -->
48+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.js"></script>
49+
<script type="text/javascript">
50+
if (typeof require !== "undefined") {
51+
require.undef("plotly");
52+
requirejs.config({
53+
paths: {
54+
plotly: [
55+
"https://cdn.plot.ly/plotly-2.35.3.min",
56+
],
57+
},
58+
});
59+
require(["plotly"], function(Plotly) {
60+
window._Plotly = Plotly;
61+
});
62+
}
63+
64+
</script>
4665
{% else %}
4766
<!-- Plotly.js -->
4867
<script src="https://cdn.plot.ly/plotly-{{site.data.jsversion.version}}.min.js"></script>
49-
{% endif %} {% if page.language == "julia" or page.language == "matlab" or
50-
page.language == "ggplot2" %}
5168
{% endif %} {% endif %}
5269
<!--
5370
//// Stylesheets

0 commit comments

Comments
 (0)