2 [[!template id=gitbranch branch=anarcat/reverse-js-includes author="[[users/anarcat]]"]]
4 As mentioned in [[todo/css_and_javascript_aggregation]] the current
5 ordering of Javascript files in [[plugins/toggle]],
6 [[plugins/relativedate]] and [[plugins/recentchangesdiff]] is
7 incorrect: Javascript files get loaded before the main content and may
8 even be loaded before the `<html>` tag for templates that indent the
9 `<body>` tag with whitespace.
11 According to the [best practices](https://developers.google.com/speed/docs/insights/mobile#PutStylesBeforeScripts) Javascript resources should be
12 presented to browsers after CSS, and "after the fold" (ATF) according
13 to the best practices. This allows the browser to download Javascript
16 I have pushed a [simple patch](https://gitlab.com/anarcat/ikiwiki/commit/5caf6e1f87530dda74ec23eb1fa7120309607cc8) which fixes this issue by including
17 Javascript on the *closing* `</body>` tag instead of the *opening* tag.
19 It also improves the regex to tolerate spaces before the `</body>` tag,
20 as some templates have (proper) indentation for the tag.
22 > [[Applied|done]], thanks --[[smcv]]