diff --git a/yesod/Scaffolding/Scaffolder.hs b/yesod/Scaffolding/Scaffolder.hs
index e45b48fb..5acaf438 100644
--- a/yesod/Scaffolding/Scaffolder.hs
+++ b/yesod/Scaffolding/Scaffolder.hs
@@ -161,6 +161,10 @@ scaffold = do
unless isTiny $ writeFile' "config/models" $(codegen "config/models")
writeFile' "messages/en.msg" $(codegen "messages/en.msg")
+ S.writeFile (dir ++ "/static/js/modernizr.js")
+ $(runIO (S.readFile "scaffold/static/js/modernizr.js.cg") >>= \bs ->
+ [|S.pack $(return $ LitE $ StringL $ S.unpack bs)|])
+
S.writeFile (dir ++ "/config/favicon.ico")
$(runIO (S.readFile "scaffold/config/favicon.ico.cg") >>= \bs -> do
pack <- [|S.pack|]
diff --git a/yesod/scaffold/Foundation.hs.cg b/yesod/scaffold/Foundation.hs.cg
index 86c7a425..c8814801 100644
--- a/yesod/scaffold/Foundation.hs.cg
+++ b/yesod/scaffold/Foundation.hs.cg
@@ -30,12 +30,13 @@ import qualified Data.ByteString.Lazy as L
import Database.Persist.~importGenericDB~
import Settings (widgetFile)
import Model
-import qualified Data.Text.Lazy.Encoding
import Text.Jasmine (minifym)
import Web.ClientSession (getKey)
import Text.Hamlet (hamletFile)
#if PRODUCTION
import Network.Mail.Mime (sendmail)
+#else
+import qualified Data.Text.Lazy.Encoding
#endif
-- | The site argument for your application. This can be a good place to
@@ -113,6 +114,9 @@ instance Yesod ~sitearg~ where
-- users receiving stale content.
addStaticContent = addStaticContentExternal minifym base64md5 Settings.staticDir (StaticR . flip StaticRoute [])
+ -- Enable Javascript async loading
+ yepnopeJs _ = Just $ Right $ StaticR js_modernizr_js
+
-- How to run database actions.
instance YesodPersist ~sitearg~ where
type YesodPersistBackend ~sitearg~ = ~dbMonad~
diff --git a/yesod/scaffold/Settings/StaticFiles.hs.cg b/yesod/scaffold/Settings/StaticFiles.hs.cg
index 1be2b4ba..5d9f51f3 100644
--- a/yesod/scaffold/Settings/StaticFiles.hs.cg
+++ b/yesod/scaffold/Settings/StaticFiles.hs.cg
@@ -1,7 +1,7 @@
{-# LANGUAGE CPP, QuasiQuotes, TemplateHaskell, TypeFamilies #-}
module Settings.StaticFiles where
-import Yesod.Static (staticFiles)
+import Yesod.Static (staticFiles, StaticRoute (StaticRoute))
-- | This generates easy references to files in the static directory at compile time.
-- The upside to this is that you have compile-time verification that referenced files
diff --git a/yesod/scaffold/julius/homepage.julius.cg b/yesod/scaffold/julius/homepage.julius.cg
index 9b38774d..5903b6ff 100644
--- a/yesod/scaffold/julius/homepage.julius.cg
+++ b/yesod/scaffold/julius/homepage.julius.cg
@@ -1,4 +1,2 @@
-window.onload = function(){
- document.getElementById("#{h2id}").innerHTML = "Added from JavaScript.";
-}
+document.getElementById("#{h2id}").innerHTML = "Added from JavaScript.";
diff --git a/yesod/scaffold/static/js/modernizr.js.cg b/yesod/scaffold/static/js/modernizr.js.cg
new file mode 100644
index 00000000..76dc0298
--- /dev/null
+++ b/yesod/scaffold/static/js/modernizr.js.cg
@@ -0,0 +1,4 @@
+/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
+ * Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-iepp-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
+ */
+;window.Modernizr=function(a,b,c){function H(){e.input=function(a){for(var b=0,c=a.length;b",a,""].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},w=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=C(e[d],"function"),C(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),x,y={}.hasOwnProperty,z;!C(y,c)&&!C(y.call,c)?z=function(a,b){return y.call(a,b)}:z=function(a,b){return b in a&&C(a.constructor.prototype[b],c)};var G=function(c,d){var f=c.join(""),g=d.length;v(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||j.touch.offsetTop===9,e.csstransforms3d=j.csstransforms3d.offsetLeft===9,e.generatedcontent=j.generatedcontent.offsetHeight>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",o.join("touch-enabled),("),i,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",o.join("transform-3d),("),i,")","{#csstransforms3d{left:9px;position:absolute}}"].join(""),['#generatedcontent:after{content:"',m,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);r.flexbox=function(){function c(a,b,c,d){a.style.cssText=o.join(b+":"+c+";")+(d||"")}function a(a,b,c,d){b+=":",a.style.cssText=(b+o.join(c+";"+b)).slice(0,-b.length)+(d||"")}var d=b.createElement("div"),e=b.createElement("div");a(d,"display","box","width:42px;padding:0;"),c(e,"box-flex","1","width:10px;"),d.appendChild(e),g.appendChild(d);var f=e.offsetWidth===42;d.removeChild(e),g.removeChild(d);return f},r.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},r.canvastext=function(){return!!e.canvas&&!!C(b.createElement("canvas").getContext("2d").fillText,"function")},r.webgl=function(){return!!a.WebGLRenderingContext},r.touch=function(){return e.touch},r.geolocation=function(){return!!navigator.geolocation},r.postmessage=function(){return!!a.postMessage},r.websqldatabase=function(){var b=!!a.openDatabase;return b},r.indexedDB=function(){for(var b=-1,c=p.length;++b7)},r.history=function(){return!!a.history&&!!history.pushState},r.draganddrop=function(){return w("dragstart")&&w("drop")},r.websockets=function(){for(var b=-1,c=p.length;++b";return(a.firstChild&&a.firstChild.namespaceURI)==q.svg},r.smil=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"animate")))},r.svgclippaths=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"clipPath")))};for(var I in r)z(r,I)&&(x=I.toLowerCase(),e[x]=r[I](),u.push((e[x]?"":"no-")+x));e.input||H(),A(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b