Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a production ready build using Ember CLI?

Tags:

I've been building a web app in Ember, and am ready to put it on a server for public use. I just want to make the /dist/ folder, which i will then manually upload to a server via FTP.

How do I build a dist for this in Ember? I can't figure out how to turn on minification and remove the tests files from the build.

I'm guessing it has something to do with my Brocfile.js, bower.json, package.json, environment.js or tester.json files, but I don't really know which one, or what that config would look like.

Bonus: I'd like to know how to turn disable/enable minification too, as I want to share my production build with a colleague to see.

It should be more that just "ember build --environment production". What files do I need to change to enable/disable minfication, to include tests etc? Or is that what "ember build --environment production" does?

Thanks!

like image 914
Drew Baker Avatar asked Apr 04 '15 08:04

Drew Baker


People also ask

What is an Ember CLI build?

Ember CLI, Ember's command line interface, provides a standard project structure, a set of development tools, and an addon system. This allows Ember developers to focus on building apps rather than building the support structures that make them run.

How do you create an Ember project?

To create a new project using Ember CLI, use the new command. In preparation for the tutorial in the next section, you can make an app called super-rentals . A new project will be created inside your current directory. You can now go to your super-rentals project directory and start working on it.

What is Ember build?

The Ember CLI (command line interface) is the official way to create, build, test, and serve the files that make up an Ember app or addon. Many things have to happen before a web app is ready for the browser. Ember CLI helps you get there with zero configuration.

How do I open Ember command line?

Open http://localhost:4200 in your browser of choice. You should see an Ember welcome page and not much else. If you are having trouble getting this running, other Ember developers would be happy to help! Visit The Ember Community Page to join chat groups or forums.


1 Answers

All you need to do to create your dist folder is to run:

ember build --environment=production 

or as @Simon has mentioned

ember build -prod 

But to add some meat to the bones:

If you need to change settings, you can do this by finding your environment.js file which should be in the config folder.

The Ember documents suggest changing the locationType: 'hash' to ensure the history works ok with the router.

You have a section which will look like this, where you can add ENV.theVariableToSet = 'myValue'; for anything you want to change

if (environment === 'production') {   ENV.locationType = 'hash' } 
like image 118
dougajmcdonald Avatar answered Nov 07 '22 01:11

dougajmcdonald