Skip to content

Instantly share code, notes, and snippets.

@andrewhowdencom
Last active January 27, 2016 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewhowdencom/94b72aa4ff84562adbcd to your computer and use it in GitHub Desktop.
Save andrewhowdencom/94b72aa4ff84562adbcd to your computer and use it in GitHub Desktop.
<!-- SUPER HACKY FAST WRITEUP -->
<!-- This does nothing -->
<script data-main="path/main.js" />
<!-- Not so good, as it blocks DOM -->
<script type="text/javascript" src="require.js" />
<script type="text/javascript" src="path/main.js" />
<!-- Not so good, as main.js may include require(['foo', 'bar'], function(f, b) {}); which has no meaning outside require.js -->
<!-- (And you can't guarantee main.js won't be executed before require.js) -->
<script type="text/javascript" src="require.js" async defer />
<script type="text/javascript" src="path/main.js" async defer />
<!-- Pretty good, as we can now load javascript with dependencies asynchronously -->
<script type="text/javascript" src="require.js" data-main="path/main" async defer />
<!-- Awesome; Javascript without dependencies. Who cares when it runs -->
<script type="text/javascript" src="module.js" async defer/>
<script type="text/javascript" src="module2.js" async defer />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment