append javascript after CSS
authorAntoine Beaupré <anarcat@debian.org>
Mon, 6 Nov 2017 19:15:22 +0000 (14:15 -0500)
committerSimon McVittie <smcv@debian.org>
Sun, 3 Feb 2019 17:01:55 +0000 (17:01 +0000)
commitd16e34c736676256b7cd3ea12797313dc1332fc3
tree8221054fb81e29b1dd853ad2e2613b784a278e0b
parentaa063aeb337271577fc426dc32b26c1ca87807e5
append javascript after CSS

Javascript resources should be presented to browsers after CSS, and
"after the fold" (ATF) according to the best practices:

https://developers.google.com/speed/docs/insights/mobile#PutStylesBeforeScripts

This change allows the browser to download Javascript files in
parallel, by including Javascript on the *closing* </body> tag instead
of the opening tag.

We also improve the regex to tolerate spaces before the body tag, as
some templates have (proper) indentation for the tag.
IkiWiki/Plugin/recentchangesdiff.pm
IkiWiki/Plugin/relativedate.pm
IkiWiki/Plugin/toggle.pm