i2g

1.3.0 • Public • Published

Ionic 2 Generator

Build Status downloads per day

===================

Welcome to the Ionic 2 Generator! You might wonder why this is called an Ionic 2 generator when it contains Angular 2 components generations as well, but fret not all your questions shall be answered!

This generator is specialised for Ionic 2 application projects. I.e. you created your project using ionic start myApp blank --v2 --ts and are too lazy to create the pages files or the components.

i2g generator comes to the rescue!

Installation

Simply run

npm install -g i2g

to have the generator globally available and voila! Creating Ionic pages and components has never been so easy!

Available commands

This generator is very simple to use, and might be to the liking of those used to the famous artisan commands.

For any help while using the generator, just run

i2g --help

to see the available commands and what they do

Creating Ionic 2 Page Files

Generating the files has never been easier! Simply run

i2g make:page PAGE_NAME

and the files will be created in app/pages/PAGE_NAME/

You could even pass the --nav to have an Ionic 2 page wired up with the Ionic 2 NavController, like so:

i2g make:page PAGE_NAME --nav

Page files include:

  • page_name.ts
  • page_name.page.html
  • page_name.scss

Creating Angular 2 Components

Angular 2 component files generation is pretty much the same, run

i2g make:component COMPONENT_NAME

and it will automagically create the component files in app/components/COMPONENT_NAME/

You could even pass the --oninit to have an Component extending the Angular 2 OnInit method, which provides a component on-load method, like so:

i2g make:component COMPONENT_NAME --oninit

Component files include:

  • component_name.component.ts
  • component_name.html
  • component_name.scss

Creating Angular 2 Services

Angular 2 service files is similar

i2g make:service SERVICE_NAME

and it will automagically create the component files in app/services/SERVICE_NAME.service.ts

Contribution

If you liked this generator and want to propose some improvements, feel free to send a pull request!

Just git clone the repository and run npm install

Make sure to have eslint and editorconfig plugins installed to conform to the format and codestyle of the project

Readme

Keywords

none

Package Sidebar

Install

npm i i2g

Weekly Downloads

9

Version

1.3.0

License

MIT

Last publish

Collaborators

  • jsalhani