Skip to content

Instantly share code, notes, and snippets.

@erbmicha
Last active August 29, 2015 14:01
Show Gist options
  • Save erbmicha/ecd5d19bfa686893c2ac to your computer and use it in GitHub Desktop.
Save erbmicha/ecd5d19bfa686893c2ac to your computer and use it in GitHub Desktop.
How-to use the latest emberfire with the latest ember-cli.

ember-cli + emberfire

Update the following files in your EmberJS application so they resemble the following:

index.html

Add the firebase.js script tag in the following spot:

 <script>
   window.ENV = {{ENV}};
 </script>
 <script src="https://cdn.firebase.com/js/client/1.0.6/firebase.js"></script>
 <script src="assets/<yourappname>.js"></script>

bower.json

Add "emberfire": "latest" to the bower.json file at the end of the dependencies like this:

"dependencies": {
...
  "loader": "stefanpenner/loader.js#1.0.0",
  "ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.1",
  "ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.1",
  "emberfire": "latest"
}

Then run bower install from the app's root directory to install the files in vendor.

Brocfile.js

You have to add the import line for emberfire.js or it doesn't get included in the application js file.

// Use this to add additional libraries to the generated output files.
app.import('vendor/ember-data/ember-data.js');
app.import('vendor/emberfire/dist/emberfire.js');

app/adapters/application.js

Create the adapters folder and the application.js file under it containing:

export default DS.FirebaseAdapter.extend({
  firebase: new Firebase('https://<yourfirebaseinstance>.firebaseio.com')
});

Now you can set up your models/routes/etc...

Have fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment