Application integration and ember-cli

So I have been thinking of converting our project to ember-cli, mostly in fear of being left out at some point, as development seems to turn more and more towards a total synergy between ember and ember-cli.

I installed all the dependencies, and now have a working ember command, that will generate a standalone application. Toying around with ember serve works and everything.

And I am at a loss: how can I integrate my application in a complete setup?

My application is normally delivered by a Django website. It is loaded from a dynamic webpage that provides a basic layout and embeds the required configuration (bootstrapping data, REST API settings and auth token, current username, locale, …). The application cannot start without those.

I have been reading the documentation twice, and have absolutely no clue on how I am supposed to integrate ember-cli’s building process in an external toolchain.

Or, basically, “how can I get rid of the coating and get a clean building process that takes my JS as input, and outputs a single JS file, and none of the cruft”? No html, no css, no vendor dependencies, just the application.

Perhaps you can use [ember-cli-deploy] (http://ember-cli.github.io/ember-cli-deploy/)?

Thanks for linking. I checked it out, and it looks like I am trying to do the exact opposite: I already have a deployment process, and I am trying to cut down on the “extras”. Ember is supposed to build myapp.js, and that’s it.

Basically, I want something akin to ember myapp -o myapp.js, something that can be used easily in standardized build tools.

→ I guess the question could be simplified as “how to build an ember-cli app from a Makefile?”.

However ember-cli-deploy seems to be built to replace the build toolsuite. I would have to explain it how to package python modules, how to setup SQL databases, how to postprocess images, and how to make a proper package out of the result (deb/rpm).
(I believe this is yet another case of “javascript developers reinventing the wheel, the non-inter-operable way”)

I suppose it is feasible. It is about having the tool do less. But simply removing all non-js files does not seem to be the solution. There probably is some things to change in some config files, I just did not find out what and how.

ember-cli-deploy is not built for the use case you have in mind. It is for the situation where you want to deploy your JS application completely separately from the API - it could be on a different server, for all it cares. (Incidentally, this is why it would be completely outside of the scope of ember-cli-deploy to set up databases, python modules, etc.)

If you want to couple your JS to your API, it does make sense to integrate this into your existing deployment process. What you need for that is basically ember build --environment=production, which will populate your dist/ folder (it will be more than one file though - but maybe this is customizable?). It’s probably going to be a slightly more manual process to integrate this into your deployment solution (especially if you want to take advantage of fingerprinting etc.), but should be doable.

1 Like

@spectras if you are using Grunt/Gulp or some other build system with your project, you need to add a task there that will run the ember cli build command ($ ember build --environment=production) and then copy the files into your Django assets folder or wherever you want to serve the application from.

You can also just call $ ember deploy and use Ember-cli-deploy-cp to make the copy.

Thanks to all for the feedback. I toyed with all options for a while, and it seems the most solid so far remains using ember build then copying the js files.

Probably, by spending some time on it I can leave out all the other files to speed up the build process. Also, it seems that using a soft link to another place works, which comes in handy when developping: I can ember build --watch and serve the file as a static asset in the correct place.

Next challenge: altering the build process to generate a self-contained bundle instead of require modules. This is what I am doing now without ember-cli and I like the fact it makes smaller code that loads faster, for no cost but setting up the right build method.

1 Like

@spectras in case you still interested, take a look my toy at https://github.com/syaiful6/shopie/blob/admin-dash/Makefile, it also Django based application. Run make copy-static-dev will build the css and js file from ember cli, and copy it to destination target on our static file. :smile:

1 Like