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

  • Ionic Cookbook
  • Hoc Phan
  • 491字
  • 2021-07-09 21:15:10

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.

主站蜘蛛池模板: 康定县| 永济市| 蛟河市| 大荔县| 定西市| 冀州市| 犍为县| 百色市| 信丰县| 平泉县| 清新县| 安图县| 修文县| 威海市| 油尖旺区| 汉源县| 东台市| 周至县| 东台市| 安福县| 伊吾县| 诏安县| 玉树县| 射阳县| 谷城县| 巍山| 滨州市| 怀来县| 诸暨市| 湖南省| 丰都县| 南木林县| 澜沧| 德令哈市| 昂仁县| 伊吾县| 娄烦县| 拜泉县| 上虞市| 藁城市| 衡阳县|