官术网_书友最值得收藏!

Setting up a development environment

Before you create the first app, your environment must have the required components ready. Those components ensure a smooth process of development, build, and test. The default Ionic project folder is based on Cordova's. Therefore you will need the Ionic CLI to automatically add the correct platform (that is, iOS, Android, or Windows Phone) and build the project. This will ensure all Cordova plugins are included properly. The tool has many options to run your app in the browser or simulator with live reload.

Getting ready

You need to install Ionic and its dependencies to get started. Ionic itself is just a collection of CSS styles and AngularJS Directives and Services. It also has a command-line tool to help manage all of the technologies such as Cordova and Bower. The installation process will give you a command line to generate initial code and build the app.

Ionic uses npm as the installer, which is included when installing Node.js. Please install the latest version of Node.js from http://nodejs.org/download/.

You will need Cordova, ios-sim (iOS Simulator), and Ionic:

$ npm install -g cordova ionic ios-sim

This single command line will install all three components instead of issuing three command lines separately. The -g parameter is to install the package globally (not just in the current directory).

For Linux and Mac, you may need to use the sudo command to allow system access:

$ sudo npm install -g cordova ionic ios-sim

There are a few common options for an integrated development environment:

  • Xcode for iOS
  • Eclipse or Android Studio for Android
  • Microsoft Visual Studio Express or Visual Studio for Windows Phone
  • Sublime Text (http://www.sublimetext.com/) for web development

All of those have a free license. Sublime Text is free for non-commercial use only but you have to purchase a license if you are a commercial developer. Most frontend developers would prefer to use Sublime Text for coding HTML and JavaScript because it's very lightweight and comes with a well-supported developer community. You could code directly in Xcode, Eclipse, or Visual Studio Express, but those are somewhat heavy duty for web apps, especially when you have a lot of windows open and just need something simple to code.

How to do it…

If you decide to use Sublime Text, you will need Package Control (https://packagecontrol.io/installation), which is similar to a Plugin Manager. Since Ionic uses Sass, it's optional to install the Sass Syntax Highlighting package:

  1. Select Sublime Text | Preferences | Package Control:
    How to do it…
  2. Select Package Control: Install Package. You could also just type the commands partially (that is, inst) and it will automatically select the right option.
    How to do it…
  3. Type Sass and the search results will show one option for TextMate & Sublime Text. Select that item to install.
    How to do it…

See also

There are tons of packages that you may want to use, such as Haml, JSHint, JSLint, Tag, ColorPicker, and so on. You can browse around this website: https://sublime.wbond.net/browse/popular, for more information.

主站蜘蛛池模板: 临泉县| 梨树县| 云林县| 宁化县| 伊金霍洛旗| 弥渡县| 嫩江县| 枣阳市| 从化市| 邓州市| 沁水县| 清水县| 勃利县| 甘泉县| 东兴市| 平塘县| 鸡泽县| 蒙山县| 宝应县| 沙洋县| 赤峰市| 泸水县| 甘肃省| 长海县| 余庆县| 正定县| 保德县| 彝良县| 广宗县| 宁陵县| 株洲县| 鄱阳县| 清流县| 冷水江市| 嘉善县| 岐山县| 东平县| 榕江县| 深水埗区| 昭通市| 镇赉县|