less than 1 minute read

Ionic for creating PWA [Progressive Web Apps)

Ionic is very famous for creating hybrid apps. If you are happy about not using Cordova plugins, you can still use Ionic for creating Web Apps and even Progressive Web Apps.

  • Create a new project as explained in Ionic website.
  • If you are building a PWA, edit src/index.html to enable the service worker.
  • done. Seriously, done. To deploy simply build (npm build --prod) and deploy the www folder.

Using some Cordova plugins

Few Cordova plugins have limited support for the browser platform. If for some reason you want to use them:

  • add the browser platform with ionic platform add browser --save
  • (optional) save the app state into package.json with ionic state save
  • build with ionic build browser --prod
  • deploy platforms/browser/www (instead of www)

Other notes

  • No tests: for some reason the Ionic team give priority to other things and left our the tests. To add them you can follow the official unittest example
  • live reload ionic run browser -lcd is not working. Github bug. Workaround: ./node_modules/.bin/ionic-app-scripts serve --sourceMap source-map --iscordovaserve --wwwDir platforms/browser/www/ --buildDir platforms/browser/www/build

Tags:

Categories:

Updated:

Comments