This is an example of how to develop a Stencil based component library and use it in an Angular application, which is not in hte same repository.
- stencil based component library on
packages/jll-stencil-library
- Angular bridge on
packages/angular-workspace/projects/jll-component-library
- Angular application on
packages/angular-workspace/projects/jll-consumer-app
- Clone the application
- Run
npm install
- On packages/jll-stencil-library run
npm run build
- On packages/angular-workspace run
npm run build:lib
- Publish or pack the angular bridge by going to
dist/jll-component-library
and runningnpm pack
or runningnpm publish
- On an angular application, the consuming app, outside this repo, consume the bridge app by running
npm install <path to the bridge app>
- You may encounter an
E404
error stating thatjll-stencil-library
is not found, it is OK, you may continue.
- You may encounter an
- On
packages/jll-stencil-library
runnpm link
- On the consuming app on 6. run
npm link jll-stencil-library
- On your main module, import
JllComponentLibraryModule
import { JllComponentLibraryModule } from 'jll-component-library';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
JllComponentLibraryModule,
],
- Consume
my-component
on one of your components
<my-component first="'first'"></my-component>
- Run the consuming app mentioned in 6. and 8.
- On packages/jll-stencil-library run
npm run build:watch
Alternatively you may runstencil build --watch
just don't run it with --dev otherwise changes won't bee seen at your consuming app.