merkle-open / generator-nitro

Your frontend? Fuel it with Nitro! Develop your frontend with a proven but flexible Node.js app, even in a large team.
MIT License
71 stars 28 forks source link

Load scripts in head with defer-attribute #169

Closed jegli closed 5 years ago

jegli commented 5 years ago

Type of issue

The issue refers to the:

Background

A while ago @dmodalek talked about the advantages of loading scripts within the head with the defer attribute. I noticed that nitro-projects are generated with the scripts at the end of the body. I propose that generated projects have the script-tag in the head with the defer attribute. Defer has browser-support down to IE10 and brings a performance gain because the script can be downloaded while the HTML is being parsed.

ernscht commented 5 years ago

This is a really good improvement of the project bootstrap. Thank you very much for your clean work.

ernscht commented 5 years ago

This is a good improvement of the project bootstrap. Performance measurements will benefit from it. Nevertheless, it must be decided in the project whether defer will be used in this way. The loading behavior of the page cannot have the desired effect with older browsers, for example.