Converting an Ember App to an Ember Engine
Well, well… good ol’ Ember engines. We had a task on our JIRA board for migrating our traditional Ember app to an engine. I thought it would be a great opportunity to learn something new. I was correct — it was a lot of fun and I learned a ton. So what are Ember Engines?
My favorite way to explain an Ember Engine is this text from the core team:
a way to break apart a large Ember app into several, smaller apps that can be merged together into a cohesive whole.
Why did we want to move to an engine in the first place?
The company I work for is pretty large. We offer these sweet web applications to allow users to chat, video conference, take phone calls, do content management stuff, and all other types of cool things. This main web app we have is written in Ember. Different teams own different pieces of the product, like most places do now-a-days.
We have this parent app that’s written in Ember, right? And it just iframes in all of these other Ember applications from teams like mine. Then one day, our director met with us and showed us the answer to our iframe party— Ember Engines. Man, they are sweet!
The benefits were pretty awesome. Instead of i-framing in, we are now just consumed by the parent app. We don’t have to do goofy stuff with the router to get the correct URL we want. Instead, it’s all done through the parent app’s router. Need to use a service that the parent app is using? No problem!
Resources to get started with engines
When I started learning about engines, the links below were great resources. I found the Engine Training link the most helpful when I was deep in the trenches of migrating our app. It really gave me a good understanding of what was required when moving a traditional app to an engine.
- Ember Engines GitHub
- Introduction to Ember Engines Video from GEM
- On the Bleeding Edge with Ember Engines by Kacey Coughlin @ EmberSF
- Engine Training via trentmwillis
- Update 01/27/2017: www.ember-engines.com is a fantastic resource with great guides
The future of my writings
Over the next few posts, I plan on sharing things I learned along the way. My hope is that it’ll help someone out one day. If you’re fairly new to Ember, maybe this will help! My agenda of topics include:
- How dependencies are handled in engines
- Merging your LESS files if you used to use ember-cli-less
- How things like ember-cli-replace and other addons change when you move to an engine
- CDN URLs when in an engine
- Build pipeline architecture idea