Redeploying Ionic code as a website

Hi all, my first post here.

I’m considering using Ionic for building a hybrid mobile app, but would ideally like to also deploy (or reuse as much as possible) the code as a website.

I’ve read the forum post below, containing an excellent answer from @mhartington, but am curious to know whether anything’s changed since this post 18 months ago with respect to the best approach for structuring the code for this type of reuse:

Have any of you attempted this, or have any tips on the best approach?

We are talking about two totally different platforms, that have different resources available and are interacted with differently. Unifying the design is would be first big problem and something tells me it has little chance of staying perfect.
Touching and dragging is different from clicking and dragging. On a desktop website, don’t be afraid to make it more animated and dynamic as desktops got much faster cpus, where mobile is slower and has battery limit. Jquery got a lot fun designs, scripts and other interfaces, where in mobile it is recommended to avoid it.
So, I would say don’t bother it and having two separate projects wont slow you down much.

Hi @blazkowicz, thanks for your reply.

You make an excellent point. I am actually happy for my website to look and interact in a very “mobile” way, as my goal would be for the website to be a reduced version of the mobile app. The reduced functionality would stem from the fact that it wouldn’t have access to phone API’s that Ionic provides (contacts, camera etc).

So aside from the look and feel of the site, would an Ionic app deploy cleanly as a website? Or are there modifications required?

I’m also curious about this in the context of Ionic 2.

I think that is possible, all you need do is to upload the www directory and ignore directories such as Plugins, resources, and so on. Also files such as config is not also needed.

1 Like

Yes very possible. I am using the same codebase for iOS android - mobile and Windows, Linux and Mac desktops apps.
Some users have the app running as a website too directly

Works exceedingly well. There area few tweaks needed like replacing some Cordova functions with JS equivalents (example save image to camera roll replaced by filesaveas etc that I switch based on platform)

1 Like

Great stuff @pliablepixels - thanks for the info

1 Like