Techie festival 2012 mobile web

35
http://www.flickr.com/photos/garryknight/5621240253/ Scotty Logan Mark Branom Stanford Techie Festival 2012 Creating a Mobile Web App

description

Intro presentation for https://github.com/scottylogan/nobeldir

Transcript of Techie festival 2012 mobile web

Page 1: Techie festival 2012 mobile web

http://www.flickr.com/photos/garryknight/5621240253/

Scotty Logan Mark Branom !

!

!

Stanford Techie Festival 2012

Creating a Mobile Web App

Page 2: Techie festival 2012 mobile web

http://www.flickr.com/photos/44456430@N04/6814917044/

Basic Tools Editor

Web Server (stanford.edu/~you)

Version Control (git)

Emulators (Android), Simulators (iOS)

Devices (iOS, Android)

Browsers (Chrome, Firefox, Safari)

Page 3: Techie festival 2012 mobile web

http://www.flickr.com/photos/booleansplit/3055314411/

More Tools JS & CSS Minimizers / Compressors

CSS Meta tools

SASS, Less, Compass

Scaffolding

Testing

Automation

Page 4: Techie festival 2012 mobile web

http://yeoman.io“a robust and

opinionated client-side stack, comprised of

tools and frameworks that can help

developers quickly build beautiful web

applications”

Page 5: Techie festival 2012 mobile web

Firefox

Test Profiles:

firefox -ProfileManager

/Applications/Firefox.app/Contents/MacOS/firefox -ProfileManager

FireBug, Dust-me Selectors, YSlow

Page 6: Techie festival 2012 mobile web

Chrome Incognito mode

Window Resizer

Developer tools

Google PageSpeed

Adobe Shadow

Chromium

Page 7: Techie festival 2012 mobile web

Safari YSlow Extension

Safari Developer Menu

Page 8: Techie festival 2012 mobile web

Internet Explorer?

Test with it, because people will use it

Page 9: Techie festival 2012 mobile web

Our App

Department directory

...

IT Services doesn’t have staff photos

Page 10: Techie festival 2012 mobile web

http://news.stanford.edu/news/2001/october3/nobel-103.html

Our App

Directory of Stanford’sNobel Laureates

Page 11: Techie festival 2012 mobile web

Mobile Only App

Page 12: Techie festival 2012 mobile web

Sencha Touch Toolkit

Model-View-Controller architecture

Javascript, CSS and HTML

http://sencha.com/products/touch/

Can build native apps!

Setup needed

Page 13: Techie festival 2012 mobile web

http://en.wikipedia.org/wiki/Model–view–controller

Page 14: Techie festival 2012 mobile web

Distributed Version Control System !

http://git-scm.com/ http://git-scm.com/book

Page 15: Techie festival 2012 mobile web

Got Code?cardinal1 ~> cd WWW

> git clone -b 1_sencha \? http://github.com/scottylogan/nobeldir.git

Cloning into 'nobledir'......Receiving objects: ..., done.Resolving deltas: ..., done.

> cd nobeldir

> git status# On branch 1_senchanothing to commit (working directory clean)

Page 16: Techie festival 2012 mobile web

First Version

Page 17: Techie festival 2012 mobile web

> git checkout 2_senchaNobelSwitched to branch '2_senchaNobel'

> git diff 1_sencha 2_senchaNobel --name-only...app/controller/Application.jsapp/model/Laureate.jsapp/view/Laureates.js...laureates.json...resources/css/app.cssresources/images/headshots/Arrow_68.jpg...resources/images/photos/Arrow_180.jpg...

Page 18: Techie festival 2012 mobile web

http://stanford.edu/~swl/nobeldir/ or

http://stanford.edu/~you/nobeldir/

Page 19: Techie festival 2012 mobile web

Change Ordering

Page 20: Techie festival 2012 mobile web

> git checkout 2_senchaNobelYearSwitched to branch '2_senchaNobelYear'

> git diff 2_senchaNobel 2_senchaNobelYear...--- a/app/store/Laureates.js+++ b/app/store/Laureates.js@@ -4,10 +4,10 @@ Ext.define('NobelDir.store.Laureates', { config: { model: 'NobelDir.model.Laureate', autoLoad: true,- sorters: 'year',+ sorters: 'displayCategory', grouper: { groupFn: function (record) {- return record.get('displayCategory');+ return record.get('year'); } }, proxy: {

Page 21: Techie festival 2012 mobile web

Native Apps?

> git checkout 4_senchaNativeSwitched to branch '4_senchaNative'

> sencha package run ios.json...

> sencha package run android.json...

Page 22: Techie festival 2012 mobile web

Are we done?

Page 23: Techie festival 2012 mobile web

We need at least 2 apps

different frameworks for mobile vs non-mobile

What about “other” browsers?

TV?

Heavy!

18MB for our app, but can be 1.2MB

Page 24: Techie festival 2012 mobile web

Time Travel

Page 25: Techie festival 2012 mobile web

Mid 1990s

Simple web pages

Terrible tools

Windows Notepad and Netscape

vi and Mosaic

Page 26: Techie festival 2012 mobile web

aka “Content First”

Page 27: Techie festival 2012 mobile web

<!DOCTYPE html><html> <head> <title>Nobel Laureates</title> </head> <body> <article> <h1>Kenneth J. Arrow</h1> <img src=”images/Arrow_68.jpg”> <a href=”arrow.html”>Economics, 1972</a> </article> ... </body></html>

Page 28: Techie festival 2012 mobile web

git checkout 5_basic

Page 29: Techie festival 2012 mobile web

Desktop

Page 30: Techie festival 2012 mobile web

Mobile

Page 31: Techie festival 2012 mobile web

Mobile First

Set viewport: <meta name="viewport" content="width=device-width, initial-scale=1" />

Page 32: Techie festival 2012 mobile web

Mobile... better

Page 33: Techie festival 2012 mobile web

Theft, again I’m stealing from Brad Frost

@brad_frost !

http://www.html5rocks.com/en/mobile/responsivedesign/

Page 34: Techie festival 2012 mobile web

CSS Breakpoints Default to narrow screen

Use em min-width @media queries to create breakpoints

27em ~= 400px

45em ~= 720px

60em ~= 960px

Page 35: Techie festival 2012 mobile web

Inlining Images

while(<>) { if (/img src="([^:]*)">/) { $b = `base64 $1`; s#$1#data:image/jpg;base64,${b}#; } print $_;}