Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hybrid Mobile Development with Ionic

You're reading from   Hybrid Mobile Development with Ionic Building highly interactive mobile apps

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781785286056
Length 242 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Gaurav Saini Gaurav Saini
Author Profile Icon Gaurav Saini
Gaurav Saini
Arrow right icon
View More author details
Toc

Directory structure and modularity

Previously in Ionic 1x, we didn't have the best directory or project structure. Slowly as Ionic and Angular evolved, developers tended to move towards the modular approach for organizing their files and folders. There were many different ways to manage your files and folders in Ionic 1x. Usually the default structure you will see in the Ionic 1x build can be used in many small projects where we don't have to deal with many files and for small projects; mainly two structures are followed for Ionic 1x based projects: byFolderType and byFeatureType. With Ionic 3, one of the best things is that we have the project structure set up in a modular way where you will have pages, providers, pipes, theme folders, and respective subsequent folders in them. Let's go through some important files inside Ionic 3 projects:

    ./src

In this folder we have our entire application code base and it is the most important:

    ./node_modules 

Here we have all our dependencies and NPM packages that are required to run the application:

    ./platforms

Here we have specific platform-based folder entries, which our app is using. When we run the ionic platform add command, you will see a specific folder created inside the platform folder:

    ./plugins

All the plugins used in our application are hosted here:

    ./resources

An entire set of icons and splash screens are inside this folder, organized according to various platforms and devices:

    
./www

Here is our index.html file, and after compilation of the code base in the src folder bundle, files, images, and SASS compiled css files are placed inside www:

    ./www/index.html

This is the entry point to our application or we can say every hybrid application. We mainly have scripts and style sheets declared in this file to run the application. As in Ionic 1 we use ng-app, here in Ionic 3 we check for <ion-app></ion-app> inside your index.html file:

    ./package.json

This defines the project metadata and dependencies that will be added to the node_modules folder. It also has information about the Cordova platform and plugins used in the application:

    
./ionic.config.json

This file contains project-specific settings such as names, IDs, proxies, and other information:

    
./src/app/main.ts

This is where we start towards the code base and also we bootstrap our application inside this file:

    ./src/app/app.module.ts

In this file we declare the pages, directives, and providers used inside our application:

    ./src/app/app.component.ts

We set the root page here and root-component is called first, which controls the application, similar to what the app.js file does in Ionic 1. However, this component is not different from other components in our application; it is just declared in the app folder. As we start to build applications in upcoming chapters, we will get to know more closely how we work around all these files and code bases.

You have been reading a chapter from
Hybrid Mobile Development with Ionic
Published in: Apr 2017
Publisher: Packt
ISBN-13: 9781785286056
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image