Skip to content

Instantly share code, notes, and snippets.

View amdev9's full-sized avatar
🌎

Alexander Matveev amdev9

🌎
View GitHub Profile
@amdev9
amdev9 / async-defer-module.md
Created October 4, 2022 18:19 — forked from jakub-g/async-defer-module.md
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@amdev9
amdev9 / machine-learning.md
Created June 20, 2019 13:15 — forked from obenjiro/machine-learning.md
Самый мягкий и пушистый путь в Machine Learning