diff options
author | Chris Rebert <github@chrisrebert.com> | 2016-06-27 02:42:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-27 02:42:13 +0300 |
commit | ead5ed6d739ad2f5b773276b2ea4f34d4ea8d162 (patch) | |
tree | 54ee4be03b6b09c8602985b886f9c5391ee03006 /Gruntfile.js | |
parent | 6cceeec695fdc5fb753703a7a55acd0ba9d62d92 (diff) |
Fix docs asset file paths in /grunt/configBridge.json (#20178)
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.
Diffstat (limited to 'Gruntfile.js')
-rw-r--r-- | Gruntfile.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Gruntfile.js b/Gruntfile.js index 9ba8c7b512..065fea7746 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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); }); }); |