Fireship · @fireship
Capacitor - Five Apps in Five Minutes
Uploaded April 2, 2018 · Length 6:50
Summary
Building a simple JavaScript app with capacitor, a new library from the ionic team that allows web technologies to interact with native SDKs, and deploying it to five platforms: iOS, Android, Windows, Mac OS, and the web.
- capacitor
- ionic
- javascript
- hybrid apps
- cross-platform apps
- progressive web apps
- native apps
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
[Music]
- 0:02
over the next five minutes we'll build a
- 0:04
simple JavaScript app then compile its
- 0:06
code for iOS Android Windows desktop Mac
- 0:09
OS and the web to make this possible
- 0:12
we'll be using a new library from the
- 0:13
ionic team called capacitor if you've
- 0:16
built hybrid apps in the past you're
- 0:17
probably familiar with Apache Cordova
- 0:19
which allows web technologies to
- 0:21
interact with native SDKs capacitor is a
- 0:24
replacement for Cordova that puts
- 0:26
progressive web apps on the same plane
- 0:28
field as native apps so you don't need
- 0:30
to constantly check which platform
- 0:31
you're on you just write your code once
- 0:33
and it should work across all platforms
- 0:35
if you're new here make sure to LIKE and
- 0:37
subscribe and if you're interested in
- 0:39
building cross-platform apps consider
- 0:41
upgrading to a pro membership to get
- 0:42
access to my ionic native with firebase
- 0:44
course before we get started I do need
- 0:47
to point out that capacitor is just an
- 0:49
alpha release at this point so it's not
- 0:51
stable enough to use in production and
- 0:52
it's API is likely to change in the
- 0:54
coming months and one other thing to
- 0:56
keep in mind is that this is a
- 0:58
standalone tool so you can use it with
- 1:00
any JavaScript framework or just plain
- 1:02
JavaScript if you wanted to for this
- 1:04
demo I'm using angular but not the ionic
- 1:06
version of angular just a plain CLI app
- 1:09
go ahead and open up the app in your IDE
- 1:11
and then install the capacitor CLI we
- 1:15
can just copy the command from the docs
- 1:16
and then run it from the terminal that
- 1:18
should install it in your project and at
- 1:20
the time of this video we're running
- 1:21
version 1.0 alpha 32 then next thing
- 1:25
we'll do is initialize our app by
- 1:26
running an NP X cap in it and you can
- 1:29
give the app name then the package ID is
- 1:32
important for mobile apps it should
- 1:34
follow a format of calm brand name dot
- 1:37
project name the only thing that's doing
- 1:39
at this point is adding this capacitor
- 1:41
config JSON file to the root of your
- 1:43
project you want to go in here and
- 1:45
change the web directory to dist because
- 1:48
an angular we compile our code to the
- 1:50
dist folder now let's make sure
- 1:52
everything's working properly by
- 1:54
building our app with ng build prod then
- 1:57
we'll serve the app with capacitor by
- 1:59
running NP x cap serve and that's going


