Defer main script

Change-Id: I5a4cd58b6b244c113bc25cbb3be2b864f8f91b4b
diff --git a/Changes b/Changes
index 444b03b..654f992 100755
--- a/Changes
+++ b/Changes
@@ -11,6 +11,7 @@
         - Remove no-js class in nonced inline script.
         - Introduce HSTS header for https_only conf.
         - Send 'nosniff' header.
+        - defer main script.
 
 0.40 2020-12-17
         - Modernize ES and fix in-loops.
diff --git a/templates/layouts/main.html.ep b/templates/layouts/main.html.ep
index 2fa2563..a7798e4 100644
--- a/templates/layouts/main.html.ep
+++ b/templates/layouts/main.html.ep
@@ -44,10 +44,10 @@
 
 % if ($c->app->mode eq 'development') {
     <link href="<%= stash 'prefix' %>/css/kalamar-<%= $Kalamar::VERSION %>.css?v=<%= random_string %>" type="text/css" rel="stylesheet" />
-    <script data-main="/js/src/app/devel" src="/js/lib/require.js" async="async"></script>
+    <script data-main="/js/src/app/devel" src="/js/lib/require.js" async="async" defer="defer"></script>
 % } else {
     <link href="<%= stash 'prefix' %>/css/kalamar-<%= $Kalamar::VERSION %>.css" type="text/css" rel="stylesheet" />
-    <script src="<%= (stash('prefix') // '') . '/js/' . loc('jsFile', 'kalamar-' . $Kalamar::VERSION . '-en.js') %>" async="async"></script>
+    <script src="<%= (stash('prefix') // '') . '/js/' . loc('jsFile', 'kalamar-' . $Kalamar::VERSION . '-en.js') %>" async="async" defer="defer"></script>
 % };