The easiest to start building Ember.js apps is with ember-cli. This tool defines a conventional way to organize Ember.js code, has generators for creating the appropriate new files, and defines how the assets get built into 2 compiled files. It is installed with npm, so you’ll need nodejs.
$ node --version v0.10.33 $ npm --version 2.1.9
If you do not have nodejs installed, follow the download instructions for your operating system.
Next, we’ll need to install
$ npm install -g ember-cli
You’ll likely also need the
$ npm install -g bower
npm install, you may need
sudo depending on how node was installed.
ember-cli installed, we can now start an Ember.js project.
ember-cli will create a series of default directories and files that will build the Ember.js application.
$ ember new ember-project $ cd ember-project $ ember serve
ember new <name> command creates the new project in a directory named after
<name>. After all the dependencies are installed (this could take a while)
cd into the project directory.
ember serve command starts a http server that will serve the compiled assets. You’ll notice that the message after
ember serve says that the server can be accessed at
0.0.0.0:4200. Visit localhost:4200 in the browser to see the default contents of the Ember.js templates.
This server process is also watching the files in the project, and will recompile them when files are added, modified, or removed. We can leave this process running, and as we make changes to the app the assets will get recompiled. The tool used behind the scenes to do the asset compilation is Broccoli.
Now you have an Ember.js project started for ember development. In other posts, we’ll look at different aspects of Ember.js and Ember Data.