- sh-components
- A library project which contains common UI library components
- sh-usage-app
- A simple angular app which uses sh-components to see how they work
- sh-wc-components
- Project used to generated web components from angular components
- It contains just one module file
app.module.ts
in which it imports all the common UI component modules and defined customElement foreach UI common component
- sh-wc-usage-app
- A simple angular app which uses web components generated from
sh-wc-components
project (indirectly web components of angular UI common components created insh-components
)
- Run
ng serve sh-usage-app
. This will start a simple app which uses angular library components. - Do any changes in
sh-components
project - Execute
ng build sh-components
to build component library - As
sh-components
is already installed and linked insh-usage-app
, it will auto reload the changes once build is completed.
(Ref: https://medium.com/@SirMaxxx/angular-6-creating-a-shareable-control-library-6a27f0ebe5c2)
- Execute
npm run prepare-standalone-wc-package
. and a complete bundle for all web components will be generated at.dist/sh-wc-components/sh-web-components.js
- Copy this
.dist/sh-wc-components/sh-web-components.js
file tono-framework-wc-usage/
folder - Run
http-server no-framework-wc-usage/
and openlocalhost:8080/index.html
. - Web components should work in the html page as expected.
- Copy this
.dist/sh-wc-components/sh-web-components.js
file toprojects/sh-wc-usage-app/src/assets
folder - Run
ng serve sh-wc-usage-app
and openlocalhost:4200
. - Web components should work in the angular app as expected.