]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Fix docs asset file paths in /grunt/configBridge.json (#20178)
authorChris Rebert <github@chrisrebert.com>
Sun, 26 Jun 2016 23:42:13 +0000 (16:42 -0700)
committerGitHub <noreply@github.com>
Sun, 26 Jun 2016 23:42:13 +0000 (16:42 -0700)
Previously, when running the docs locally, the site, rooted at:
    http://localhost:9001/
would reference docs assets using relative URLs such as:
    /../assets/js/vendor/anchor.min.js
which is equivalent to:
    http://localhost:9001/../assets/js/vendor/anchor.min.js
which is nonsense, since the root directory has no parent directory.
Apparently browsers silently ignore this extra '..', hence why this wasn't noticed until now.
But if you adjust Jekyll's `baseurl` setting, this mistake causes incorrect URLs to get generated.

This commit corrects the problem by removing the extra '../' from the paths.

These paths are also referenced in the Gruntfile, where the fix actually allows us to simplify the code.
Previously, in the Gruntfile, we were doing, e.g.:
    path.join('./docs/assets', '../assets/js/vendor/anchor.min.js')
which calculates to:
    ./docs/assets/../assets/js/vendor/anchor.min.js
which can be simplified to:
    ./docs/assets/js/vendor/anchor.min.js
So we can remove the '/assets' suffix from the left argument
and the '../' prefix from the right argument
and still obtain the same result.

Gruntfile.js
grunt/configBridge.json

index 9ba8c7b512dff6e78e28f6c958f204a609b751a7..065fea7746c13f6036f86b36b160623239cc772c 100644 (file)
@@ -24,7 +24,7 @@ module.exports = function (grunt) {
 
   Object.keys(configBridge.paths).forEach(function (key) {
     configBridge.paths[key].forEach(function (val, i, arr) {
-      arr[i] = path.join('./docs/assets', val);
+      arr[i] = path.join('./docs', val);
     });
   });
 
index 2bda83394375e8b8b7ca022db0a2144e508fa060..140d9ab78ac794db67fa96ac9953ead42fd01252 100644 (file)
@@ -1,10 +1,10 @@
 {
   "paths": {
     "docsJs": [
-      "../assets/js/vendor/anchor.min.js",
-      "../assets/js/vendor/clipboard.min.js",
-      "../assets/js/vendor/holder.min.js",
-      "../assets/js/src/application.js"
+      "assets/js/vendor/anchor.min.js",
+      "assets/js/vendor/clipboard.min.js",
+      "assets/js/vendor/holder.min.js",
+      "assets/js/src/application.js"
     ]
   }
 }