Setting Up Ember CLI with Emblem and CoffeeScript
I’ve been using Ember CLI for various projects. Two things that I like to do right out of the gate is to enable CoffeeScript (instead of JavaScript) and Emblem JS (instead of Handlebars templates). Both of these tasks are pretty easy thanks to Broccoli.
Start by creating a new Ember CLI application:
CoffeeScript
Now let’s get CoffeeScript working, it’s as easy as installing a Broccoli component
Now, let’s modify router.js
to router.coffee
, it’ll look like this when you are done. Note the import
and export
are wrapped in backticks as CoffeeScript doesn’t support ES6 Module syntax.
Next, app.js
to app.coffee
Now run ember serve
, and if all is successful, you should see “Welcome to Ember js”.
Emblem JS
Like CoffeeScript, we’ll use a Broccoli package for Emblem JS.
Then we can convert application.hbs
to application.emblem
Restart the Ember server (CTRL+C
to stop, ember serve
to start), and again we should see “Welcome to Ember.js”
That’s all it takes. Broccoli makes theses tasks trivial.