hasper icon indicating copy to clipboard operation
hasper copied to clipboard

Remove jquery/scripts from hasper

Open dencold opened this issue 9 years ago • 0 comments

Linked into every page on the hasper theme is this partial include:

  {{partial "scripts.html" .}}

Which comprises of these three script tags:

<script type="text/javascript" src="{{.Site.BaseURL}}js/jquery.js"></script>
<script type="text/javascript" src="{{.Site.BaseURL}}js/jquery.fitvids.js"></script>
<script type="text/javascript" src="{{.Site.BaseURL}}js/index.js"></script>

Adding around 200ms of load time to the page on a 4g device: image

The only thing we use all the jquery code for is some smooth scrolling to jump from the cover page down to the content:

https://github.com/dencold/hasper/blob/23c4aedd39000716f15481b6d80cf9736a0e348e/static/js/index.js#L27

Definitely not worth all that load.

Look to replace this with a simple function that achieves the same functionality and drops the jquery requirement.

dencold avatar Jan 13 '17 19:01 dencold