From a62b0727d8236ced40a9b98b18914de97fcf9e22 Mon Sep 17 00:00:00 2001 From: ines Date: Fri, 3 Nov 2017 11:29:21 +0100 Subject: [PATCH] Tidy up and always use bundle in built site for now Just to be safe --- website/_includes/_scripts.jade | 76 ++++++++++++++++----------------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/website/_includes/_scripts.jade b/website/_includes/_scripts.jade index 05a468076..0be2e2e98 100644 --- a/website/_includes/_scripts.jade +++ b/website/_includes/_scripts.jade @@ -13,7 +13,6 @@ script(src="/assets/js/vendor/prism.min.js") if SECTION == "models" script(src="/assets/js/vendor/chart.min.js") - script(src="/assets/js/models.js?v#{V_JS}" type="module") script if quickstart @@ -24,15 +23,15 @@ script | (ga.q=ga.q||[]).push(arguments)}; ga.l=+new Date; | ga('create', '#{ANALYTICS}', 'auto'); ga('send', 'pageview'); - -if IS_PAGE - script + if IS_PAGE | ((window.gitter = {}).chat = {}).options = { | useStyles: false, | activationElement: '.js-gitter-button', | targetElement: '.js-gitter', | room: '!{SOCIAL.gitter}' | }; + +if IS_PAGE script(src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer) @@ -48,39 +47,36 @@ if IS_PAGE - ModelLoader = "new ModelLoader('" + MODELS_REPO + "'," + JSON.stringify(CURRENT_MODELS) + "," + JSON.stringify(MODEL_LICENSES) + "," + JSON.stringify(MODEL_BENCHMARKS) + ");" - ModelComparer = "new ModelComparer('" + MODELS_REPO + "'," + JSON.stringify(MODEL_LICENSES) + "," + JSON.stringify(MODEL_BENCHMARKS) + "," + JSON.stringify(LANGUAGES) + "," + JSON.stringify(MODEL_META) + "," + JSON.stringify(default_models || false) + ");" -//- Browsers with JS module support. - Will be ignored otherwise. - -script(type="module") - | import ProgressBar from '/assets/js/progress.js'; - !=ProgressBar - if changelog - | import Changelog from '/assets/js/changelog.js'; - !=Changelog - if IS_PAGE - | import NavHighlighter from '/assets/js/nav-highlighter.js'; - !=NavHighlighter - | import GitHubEmbed from '/assets/js/github-embed.js'; - !=GitHubEmbed - if HAS_MODELS - | import { ModelLoader } from '/assets/js/models.js'; - !=ModelLoader - if compare_models - | import { ModelComparer } from '/assets/js/models.js'; - !=ModelComparer - -//- Browsers with no JS module support. - Won't be fetched or interpreted otherwise. - -script(nomodule src="/assets/js/rollup.js") -script(nomodule) - !=ProgressBar - if changelog - !=Changelog - if IS_PAGE - !=NavHighlighter - !=GitHubEmbed - if HAS_MODELS - !=ModeLoader - if compare_models - !=ModelComparer +if environment == "deploy" + //- DEPLOY: use compiled rollup.js and instantiate classes directly + script(src="/assets/js/rollup.js") + script + !=ProgressBar + if changelog + !=Changelog + if IS_PAGE + !=NavHighlighter + !=GitHubEmbed + if HAS_MODELS + !=ModeLoader + if compare_models + !=ModelComparer +else + //- DEVELOPMENT: Use ES6 modules + script(type="module") + | import ProgressBar from '/assets/js/progress.js'; + !=ProgressBar + if changelog + | import Changelog from '/assets/js/changelog.js'; + !=Changelog + if IS_PAGE + | import NavHighlighter from '/assets/js/nav-highlighter.js'; + !=NavHighlighter + | import GitHubEmbed from '/assets/js/github-embed.js'; + !=GitHubEmbed + if HAS_MODELS + | import { ModelLoader } from '/assets/js/models.js'; + !=ModelLoader + if compare_models + | import { ModelComparer } from '/assets/js/models.js'; + !=ModelComparer