JLavoie
JLavoie

Reputation: 17596

Same Ionic Framework interface for Mobile and non-mobile browsers?

I am working on 2 identical GUI: 1 for mobile (using Ionic), 1 for non-mobile. The non-mobile interface is responsive so it's already mobile-ready! So, 99% of the code is the same.

I develop the mobile part of the GUI in Ionic Framework (Angular). The non-mobile interface is using Angular only. I could simply merge the non-mobile site (Angular only) into the Ionic project. Then, I would only have ONE branch to maintain.

Knowing that we can use the command "ionic serve" to expose the Ionic Interface in the non-mobile browser, I am thinking to simply use the command "ionic serve" on the production server to expose the web interface of the ionic to non-mobile users. Is it a good practice? If not, what should I do to have 1 branch only?

Upvotes: 0

Views: 187

Answers (1)

aorfevre
aorfevre

Reputation: 5064

Doing ionic serve is creating a webserver on your folder www

This will not perform many very usefull operation for production such as :

  • minification / offuscation
  • clearing comments
  • sass build etc...

Those tasks are for example triggered by grunt / gulp tasks or hooks into ionic build command if your properly configure it.

Therefore, I'd recommand you the two possibilities :

  1. cordova platform add browser

This is the one I prefer, as you can take good advange of cordova hooks steps and use the same hooks for mobile & non mobile.

  1. Copy your www folder and make your own build process

In both case, you'll have to perform some tests as ionic is developped and optimized for Android & iOS, which is not all mobiles (ex: windows phones ) and not browsers. I remember on one project adding some spec class for browser and detecting if user uses browser or not for specific behaviours.

Upvotes: 1

Related Questions