Skip to content

Instantly share code, notes, and snippets.

@minikomi
Created October 12, 2011 09:55
Show Gist options
  • Save minikomi/1280785 to your computer and use it in GitHub Desktop.
Save minikomi/1280785 to your computer and use it in GitHub Desktop.
mobile html5 boilerplate haml
<!doctype html>
/ Conditional comment for mobile ie7 http://blogs.msdn.com/b/iemobile/
/[if IEMobile 7 ] <html class="no-js iem7">
/ [if (gt IEMobile 7)|!(IEMobile)]><!
%html.no-js
/ <![endif]
%head
%meta{:charset => "utf-8"}
%title
%meta{:content => "", :name => "description"}
%meta{:content => "", :name => "author"}
%meta{:content => "True", :name => "HandheldFriendly"}
%meta{:content => "320", :name => "MobileOptimized"}
%meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}
%link{:href => "img/h/apple-touch-icon.png", :rel => "apple-touch-icon-precomposed", :sizes => "114x114"}
%link{:href => "img/m/apple-touch-icon.png", :rel => "apple-touch-icon-precomposed", :sizes => "72x72"}
%link{:href => "img/l/apple-touch-icon-precomposed.png", :rel => "apple-touch-icon-precomposed"}
%link{:href => "img/l/apple-touch-icon.png", :rel => "shortcut icon"}
%meta{:content => "black", :name => "apple-mobile-web-app-status-bar-style"}
:javascript
(function(a,b,c){if(c in b&&b[c]){var d,e=a.location,f=/^(a|html)$/i;a.addEventListener("click",function(a){d=a.target;while(!f.test(d.nodeName))d=d.parentNode;"href"in d&&(d.href.indexOf("http")||~d.href.indexOf(e.host))&&(a.preventDefault(),e.href=d.href)},!1)}})(document,window.navigator,"standalone") %link{:href => "img/l/splash.png", :rel => "apple-touch-startup-image"}
%link{:href => "img/l/splash.png", :rel => "apple-touch-startup-image"}
%meta{:content => "on", "http-equiv" => "cleartype"}
%link{:href => "css/style.css?v=1", :rel => "stylesheet"}
%script{:src => "js/libs/modernizr-custom.js"}
:javascript
Modernizr.mq('(min-width:0)') || document.write('\x3C/script>')
%body
#container
%header
#main{:role => "main"}
= yield
%footer
%script{:src => "//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"}
:javascript
window.jQuery || document.write('<\/script>')
MBP.scaleFix();
var _gaq=[["_setAccount","UA-XXXXX-X"],["_trackPageview"]];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment