I have created an ionic app and want to deploy it as a website. What's the best way to deploy it on a custom domain? I was thinking of using azure web app to host the ionic app. All the documentation refers to use it as hybrid app for IOS and Android. But at this point, we are only interested for it to function as a website.
问题:
回答1:
edit: Ionic 1.2 officially supports deployment as a website!
As I stated in the comment to the only provided answer - I disagree.
If you're not using any Cordova plugins then there is no problem (if you really wish to) to upload the contents of the www
folder to your server, and woila - you'll have the same app.
However, it is important to note that Ionic never intended for such a use, and the users of your "website" will have to have a newest browser in order to see the "website" correctly (not broken down due to some feature that Ionic is using in either CSS or HTML that some older browsers do not support).
You can take a look at the tutorial with step by step on how to recreate the application. I literally took out the contents of the www
folder and put it on the web server, and as you can see it works.
回答2:
It is a late answer, but as an official for Ionic 2:
With Ionic 2 we are fully supporting the web (including eventual built in support for Progressive web apps) as a platform right alongside Android, IOS, Windows 10 and Electron. Thanks for using Ionic!
And
If you are using certain Cordova plugins that only work on native platforms then these will not work on the web, although if you are using Ionic native they will fail gracefully. But if you stay away from using those certain plugins, or write logic to provide an alternative when on the web then it should work perfectly. Also, our browser support includes Chrome, Safari, Firefox, Opera(since it's just chrome nowadays), and Edge. We do not support any version of Internet Explorer with Ionic 2. So basically, as long as you keep Cordova plugins in mind, the same Ionic 2 project that works on your Android, IOS or Windows 10 device will work just as well in the browser. Thanks!
The source for this: https://github.com/ionic-team/ionic/issues/7376
From my experience in Ionic 1, it is simple to work on a website, it is just copy/paste for www
directory, actually, it does make sense, you are running AngularJS website! you could have a few errors and some of the functionalities not working (i mean the native plugins as for example facebookConnect
) but you can handle it and run the web-specific version instead.
In our company, we do have an application work as a website with firebase, and mobile app with the same code, but you do need to write a few lines to handle web browsing side or mobile native call.
回答3:
Check my answer ionic: using the framework with only HTML5 on the idea of using it as a web application.
You could deploy it as static website on s3 and use your custom domain to point to s3. You can configure your s3 bucket to be used as a static website host. There are many tutorials on how to go about it.
回答4:
For ionic2, add corbova browser platform, then upload to web server platforms/browser/www