Ember CLI
By Alex LaFroscia
How does it help?
- Create and manage project structure
- Handles building and bundling your assets through Broccoli
- Helps generate new files with the proper boilerplate
- Manage tests
- Build for production
How to Get It
# Install through NPM
npm install -g ember-cli
# Optional: Install PhantomJS for testing
npm install -g phantomjs
Dependencies:
- NPM
- Bower
For Testing:
- PhantomJS
Using Ember-CLI
# Create a new app
ember new test-app
# Start the development server
# Your project will be set up on port 4200 with live-reloading
ember server
# Create a route and template
ember generate route index
# Create an array controller
ember g controller --type=array
# Run the test suite
ember test # CI Mode
ember test --server # Browser mode
Differences from Ember without the CLI
ES6 Module Syntax
// app/routes/index.js
import Ember from 'ember';
import FooMixin from "./mixins/foo";
export default Ember.Route.extend(FooMixin, {
model: function() {
return ['red', 'yellow', 'blue'];
}
});
- The Ember-CLI uses the ES6 syntax for modules
- "Ember" is not in the global namespace
- Not a big deal because of the generators
Demo
Ember CLI
By Alex LaFroscia
Ember CLI
Introduction to the Ember CLI
- 1,373