Non-Ember Things in Ember

The Ember community is great andfull of great ember-cli friendly addonsto add to your project. UsingRedux? Check outember-redux. NeedFastClick? Check out... well, actually your best bet isember-hammertimebut you get the point.

Butsometimes you justneedto incorporate something that isn't Ember ready. Today that's easier than ever!

Show Me

In this example we'll be addingurl-polyfillto our Ember app.I knowember-urlis out there but it lacks some of the functionalityurl-polyfilloffers.

  1. yarn add url-polyfillornpm install --save url-polyfill
  2. In yourember-cli-build.jswithin themodule.exports = function() {add the following...
app.import('node_modules/url-polyfill/url-polyfill.js');

You're done!

For bonus points, you can even configure which import you use based on the environment...

app.import({
  development: 'PATH/file.js',
  production: 'PATH/file.min.js',
});

This also works with css files to bring in your favorite CSS framework, animation library or other tool. If you're still using bower, simply point your import path tobower_components/DEPENDENCY/FILE.EXT.

But, wait, I have some setup I need to do!

That's cool too! An initializer is likely what you'll want.

ember generate initializer myInitializer

Then within there you can run any initialization code your heart desires and it'll run at app load.

Want to go further?

Make an ember-addon for your favorite tool and publish it on npm! The community would appreciate it and love the easy of anember install.

Go make great things. Or... combine great things into an even greater thing!