Production ember getting started

30
Production Ember Building production ember apps

description

Presentation from our first Ember.js SLC meetup. Getting started with a production ember app.

Transcript of Production ember getting started

Page 1: Production ember getting started

Production EmberBuilding production ember apps

Page 2: Production ember getting started

whoamitwitter: @jason_madsen

github: knomedia

Page 3: Production ember getting started

Why?

Page 4: Production ember getting started

Why?http://emberjs.com/guides/

Page 5: Production ember getting started

TopicsRequirements

PartsRequest Flow

Handlebars TemplatesEmber Build Tools

Page 6: Production ember getting started

Ember RequirementsjQuery

HandlebarsEmber

Page 7: Production ember getting started

Ember’s MVC ...PartsSame letters, different responsibilities

Page 8: Production ember getting started

Ember’s MVC ...Parts

Router

Route

ControllerModel Template

ViewEmber-data (or?)

Server

Page 9: Production ember getting started

Ember’s MVC ...Parts

Router

Route

ControllerModel Template

ViewEmber-data (or?)

Server

Initial request

Page 10: Production ember getting started

Ember’s MVC ...Parts

Router

Route

ControllerModel Template

ViewEmber-data (or?)

ServerConvert url to route

and route to url

Page 11: Production ember getting started

Ember’s MVC ...Parts

Router

Route

ControllerModel Template

ViewEmber-data (or?)

Server

Get appropriate modeland pass to controller

Page 12: Production ember getting started

Ember’s MVC ...Parts

Router

Route

ControllerModel Template

ViewEmber-data (or?)

Server

Represent the databeing persisted

Page 13: Production ember getting started

Ember’s MVC ...Parts

Router

Route

ControllerModel Template

ViewEmber-data (or?)

Server

Represent the data as it is displayed

Page 14: Production ember getting started

Ember’s MVC ...Parts

Router

Route

ControllerModel Template

ViewEmber-data (or?)

Server

Display the controllerdata

Page 15: Production ember getting started

Ember’s MVC ...Parts

Router

Route

ControllerModel Template

ViewEmber-data (or?)

Server

Handle low levelevents ontemplate

Page 16: Production ember getting started

Ember’s MVC ...Parts

Router

Route

ControllerModel Template

ViewEmber-data (or?)

Server

Initial request

Page 17: Production ember getting started

ConventionConfiguration

aka “prescriptive”

Naming conventions = Ember building boiler plate objects

Page 18: Production ember getting started

Handlebars Templatesinline vs pre-compiled

<script  id="entry-­‐template"  type="text/x-­‐handlebars-­‐template">    template  content</script>

Page 19: Production ember getting started

Precompiled TemplatesSmaller runtime required

no browser compile (faster)

Page 20: Production ember getting started

Precompiled Templates... will significantly speed up boot time, as compilation is

the most expensive part of Handlebars.

Page 21: Production ember getting started

Pre-Compile OptionsManuallyBuild Tool

Page 22: Production ember getting started

Manual Pre-Compile

Page 23: Production ember getting started

Manual Pre-Compilehttps://github.com/gabrielgrant/node-ember-precompile

npm  install  -­‐g  ember-­‐precompileember-­‐precompile  template...  [-­‐f  OUTPUT_FILE]

Page 25: Production ember getting started

ember-toolsfile organization for sanity

scaffolding for learningprecompile templates

build to single file for deploygenerators

commonjs modules

Page 26: Production ember getting started

ember-toolsnpm  install  -­‐g  ember-­‐toolsember  create  my-­‐appcd  my-­‐appember  generate  -­‐-­‐scaffold  person  name:string  age:numberember  buildopen  index.html#  visit  #/people

Page 27: Production ember getting started

ember-toolsember  watch

Page 28: Production ember getting started

ember-tools generatorshttps://github.com/rpflorence/ember-tools#generator-examples

Page 29: Production ember getting started

ember-toolsIncludes it’s own pre-compiler

ember  precompile  -­‐d  src  -­‐f  output.js

Page 30: Production ember getting started

Wrap UpUse a build system

Precompile templatesUse Ember Handlebars runtime only

Concat (minify?) your js

http://emberjs.com/guides/