Skip to content

Commit

Permalink
Merge pull request #2537 from WPO-Foundation/vendorize
Browse files Browse the repository at this point in the history
Version and move vendor JS into assets/js/vendor/
  • Loading branch information
stoyan authored Nov 15, 2022
2 parents cd4da10 + 3a012af commit 7cb54a3
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 14 deletions.
6 changes: 1 addition & 5 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
www/chrome
www/assets/css/vendor
www/assets/js/catchpoint-rum.js
www/assets/js/dygraph-combined.js
www/assets/js/codeflask.module.js
www/assets/js/jquery.js
www/assets/js/prism.js
www/assets/js/vendor
File renamed without changes.
2 changes: 0 additions & 2 deletions www/assets/js/dygraph-combined.js

This file was deleted.

8 changes: 5 additions & 3 deletions www/assets/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ async function initCodeField(source, language = "js") {
return; // already initialized
}
// load Flask
const { default: CodeFlask } = await import("/assets/js/codeflask.module.js");
const { default: CodeFlask } = await import(
"/assets/js/vendor/codeflask-1.4.1.module.js"
);
const originalTextarea = document.getElementById(source);
// editor container
const codeEl = document.createElement("div");
Expand Down Expand Up @@ -311,10 +313,10 @@ async function loadPrism() {
const ss = document.createElement("link");
ss.rel = "stylesheet";
ss.type = "text/css";
ss.href = "/assets/css/vendor/prism.css";
ss.href = "/assets/css/vendor/prism-1.29.0.css";
document.head.appendChild(ss);

// todo: find a Prism distro that is a proper module
await import("/assets/js/prism.js");
await import("/assets/js/vendor/prism-1.29.0.js");
return window.Prism;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion www/footer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</footer>
<?php
if (!isset($site_js_loaded) || !$site_js_loaded) {
echo "<script src=\"{$GLOBALS['cdnPath']}/assets/js/jquery.js\"></script>\n";
echo "<script src=\"{$GLOBALS['cdnPath']}/assets/js/vendor/jquery-1.7.1.js\"></script>\n";
echo "<script src=\"{$GLOBALS['cdnPath']}/assets/js/site.js?v=" . VER_JS . "\"></script>\n";
$hasJquery = true;
}
Expand Down
2 changes: 1 addition & 1 deletion www/head.inc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ echo "\n</style>\n";
// include the analytics code if it is appropriate
if (!isset($noanalytics)) {
echo "<script>";
require_once WWW_PATH . '/assets/js/catchpoint-rum.js';
require_once WWW_PATH . '/assets/js/vendor/catchpoint-rum.js';
echo "</script>";
}

Expand Down
2 changes: 1 addition & 1 deletion www/templates/layouts/footer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (!strcasecmp('Test Result', $tab) && (!isset($nosubheader) || !@$nosubheader)

<?php
if (!isset($site_js_loaded) || !$site_js_loaded) {
echo "<script src=\"{$GLOBALS['cdnPath']}/assets/js/jquery.js\"></script>\n";
echo "<script src=\"{$GLOBALS['cdnPath']}/assets/js/vendor/jquery-1.7.1.js\"></script>\n";
echo "<script src=\"{$GLOBALS['cdnPath']}/assets/js/site.js?v=" . constant('VER_JS') . "\"></script>\n";
$hasJquery = true;
}
Expand Down
2 changes: 1 addition & 1 deletion www/templates/layouts/head.inc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ echo "\n</style>\n";
// include the analytics code if it is appropriate
if (!isset($noanalytics)) {
echo '<script>';
require_once __DIR__ . '/../../assets/js/catchpoint-rum.js';
require_once __DIR__ . '/../../assets/js/vendor/catchpoint-rum.js';
echo '</script>';
}

Expand Down

0 comments on commit 7cb54a3

Please sign in to comment.