Config CDN for viz.js

This commit is contained in:
Yukai Huang 2016-10-13 08:56:02 +08:00
parent dda41c489d
commit b90c26fe90
5 changed files with 8 additions and 1 deletions

View file

@ -306,6 +306,7 @@ function finishView(view) {
} }
}); });
//graphviz //graphviz
var Viz = require("viz.js");
var graphvizs = view.find(".graphviz.raw").removeClass("raw"); var graphvizs = view.find(".graphviz.raw").removeClass("raw");
graphvizs.each(function (key, value) { graphvizs.each(function (key, value) {
try { try {

View file

@ -20,7 +20,7 @@
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script> <script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
<script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script> <script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script>
<% } %> <% } %>
<!--codemirror--> <script src="//cdnjs.cloudflare.com/ajax/libs/viz.js/1.3.0/viz.js" defer></script>
<%- include build/index-scripts %> <%- include build/index-scripts %>
<script src="<%- url %>/js/google-drive-upload.js" defer></script> <script src="<%- url %>/js/google-drive-upload.js" defer></script>
<script src="<%- url %>/js/google-drive-picker.js" defer></script> <script src="<%- url %>/js/google-drive-picker.js" defer></script>

View file

@ -102,6 +102,7 @@
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script> <script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
<script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script> <script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script>
<% } %> <% } %>
<script src="//cdnjs.cloudflare.com/ajax/libs/viz.js/1.3.0/viz.js" defer></script>
<%- include build/pretty-scripts %> <%- include build/pretty-scripts %>
<script src="<%- url %>/js/reveal-markdown.js" defer></script> <script src="<%- url %>/js/reveal-markdown.js" defer></script>
<%- include ga %> <%- include ga %>

View file

@ -102,6 +102,7 @@
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script> <script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
<script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script> <script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script>
<% } %> <% } %>
<script src="//cdnjs.cloudflare.com/ajax/libs/viz.js/1.3.0/viz.js" defer></script>
<%- include build/slide-scripts %> <%- include build/slide-scripts %>
</body> </body>
</html> </html>

View file

@ -66,6 +66,10 @@ module.exports = {
extensions: ["", ".js"] extensions: ["", ".js"]
}, },
externals: {
"viz.js": "Viz"
},
module: { module: {
loaders: [{ loaders: [{
test: /\.json$/, test: /\.json$/,