Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between "ionic build" and "ionic prepare"?

Tags:

Just learning to use Ionic to build a hybrid application, and wasn't really able find a great deal of info on the ionic prepare command. Anyone happen to know what it is or what the difference between it and ionic build?

like image 331
adesotamn Avatar asked Jul 05 '15 21:07

adesotamn


2 Answers

From the official documentation:

If you want to get advanced, you can also open up the project file for a specific platform by opening the required XCode or Android Eclipse project in platforms/PLATFORM inside the root of your project. Then, you can build and test from inside the platform-specific IDE. Note: if you go this route, I recommend still working inside of the root www folder, and when you've made changes to this folder, run the command: $ cordova prepare ios which will update the iOS specific project with the code from the www folder. Note: this will overwrite any changes you've made to the platforms/ios/www and other platform-specific folders.

So, to summarize this part - if you're using XCode to test and run your code, after you change some part of the code you just have to run ionic prepare to update the iOS project which then again you continue to use in XCode.

ionic build command actually prepares the final (for example in Android it's the .apk file) file which then could be copied to your device and test by running it manually on the device (or by using the ionic emulate command to test it on the emulator).

like image 187
Nikola Avatar answered Oct 28 '22 20:10

Nikola


Nikola's answer is correct. To sum it up:

  • ionic prepare <platform> copies all files from the www folder into the target platform's www folder.
  • ionic build <platform> also does this, but also builds the app's source code so that it can be run on a simulator/emulator or a device.
like image 40
Daniel Saidi Avatar answered Oct 28 '22 21:10

Daniel Saidi