Is there be any way to use single file components in Ember?

I know there’s a ember-component-css add-on, but I would rather have the HTML/CSS/JS all in one file. A setup similar to .vue single file components.

1 Like

No there isn’t. You will need a package.json and some .js file. Not sure if I would want it but I think you can let browserify create this file. css will have to be included as html style I think. You would have to run npm run build like this:

Not yet, but coming “soon”

The module unification RFC actually covered this use case. It let you mix style, template, and js all in one file. Erik Bryn did a demo at a Meetup before, but not sure how ready that was. Maybe hit him up on slack?

Very late to the party here, but I’ve hacked up a REALLY simple Single-File-Component script:

Posted that script for discussion just today at:

Hope it helps! Cheers!

1 Like