diff options
author | anarcat <anarcat@web> | 2017-11-06 15:36:40 -0400 |
---|---|---|
committer | admin <admin@branchable.com> | 2017-11-06 15:36:40 -0400 |
commit | 8b3c8e327da06f6b50d5ffe159b090f7818e21cd (patch) | |
tree | 8e0a3385a7edd27c0e99f1c92523986dd8a06243 /doc | |
parent | fbcf2439ebdb0f11ab06894801a8d8bde62323a8 (diff) | |
download | ikiwiki-8b3c8e327da06f6b50d5ffe159b090f7818e21cd.tar ikiwiki-8b3c8e327da06f6b50d5ffe159b090f7818e21cd.tar.gz |
propose a javascript optimization
Diffstat (limited to 'doc')
-rw-r--r-- | doc/todo/fix_javascript_load_ordering.mdwn | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/todo/fix_javascript_load_ordering.mdwn b/doc/todo/fix_javascript_load_ordering.mdwn new file mode 100644 index 000000000..6a4e15ff2 --- /dev/null +++ b/doc/todo/fix_javascript_load_ordering.mdwn @@ -0,0 +1,20 @@ +[[!tag patch]] +[[!template id=gitbranch branch=anarcat/reverse-js-includes author="[[users/anarcat]]"]] + +As mentioned in [[todo/css_and_javascript_aggregation]] the current +ordering of Javascript files in [[plugins/toggle]], +[[plugins/relativedate]] and [[plugins/recentchangesdiff]] is +incorrect: Javascript files get loaded before the main content and may +even be loaded before the `<html>` tag for templates that indent the +`<body>` tag with whitespace. + +According to the [best practices](https://developers.google.com/speed/docs/insights/mobile#PutStylesBeforeScripts) Javascript resources should be +presented to browsers after CSS, and "after the fold" (ATF) according +to the best practices. This allows the browser to download Javascript +files in parallel. + +I have pushed a [simple patch](https://gitlab.com/anarcat/ikiwiki/commit/5caf6e1f87530dda74ec23eb1fa7120309607cc8) which fixes this issue by including +Javascript on the *closing* `</body>` tag instead of the *opening* tag. + +It also improves the regex to tolerate spaces before the `</body>` tag, +as some templates have (proper) indentation for the tag. |