-
Notifications
You must be signed in to change notification settings - Fork 26
HelixUI with Angular
Ryan Johnson edited this page Jan 31, 2020
·
7 revisions
- Latest stable NodeJS (for the
npm
andnpx
command-line utilities)
(all paths are relative to the root of the project directory)
- Your app was bootstrapped via
@angluar/cli
- Vendor assets live in
src/assets/vendor/
(coded by 3rd party)
npm install helix-ui
npm install --save-dev vendor-copy
-
vendor-copy
allows you to automatically copy bundled assets to your project afternpm install
.
Include the following configurations:
{
"scripts": {
"postinstall": "vendor-copy"
},
"devVendorCopy": [
{
"from": "node_modules/helix-ui/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js",
"to": "src/assets/vendor/webcomponents-loader.js"
},
{
"from": "node_modules/helix-ui/node_modules/@webcomponents/webcomponentsjs/bundles",
"to": "src/assets/vendor/bundles"
},
{
"from": "node_modules/helix-ui/dist/css/helix-ui.min.css",
"to": "src/assets/vendor/helix-ui.min.css"
}
]
}
Run the following to copy files configured via the vendorCopy
configuration, above.
npx vendor-copy
NOTE: You may also want to verify that your postinstall
script is working as expected, by running npm install
.
Add the following to the bottom of the <head>
element:
<!-- Required for HelixUI to function in older browsers -->
<script src="assets/vendor/webcomponents-loader.js"></script>
TBD...
If you want use @angular/cli
to bootstrap your application, you'll need to make sure to do the following to ensure maximum compatibility with HelixUI.
- copy
node_modules/helix-ui/
assets tosrc/assets/helix-ui/
- copy
node_modules/@webcomponents/webcomponentsjs/
assets tosrc/assets/webcomponentsjs/
- update
src/index.html
contents with official Helix layout markup - make sure
<link>
and<scripts>
insrc/index.html
point to files insrc/assets/helix-ui
andsrc/assets/webcomponentsjs
- add
CUSTOM_ELEMENTS_SCHEMA
to the list of schemas insrc/app/app.module.ts
(see snippet below)
- Configures angular that to allow 3rd-party custom elements.
/*
* src/app/app.module.ts
*/
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class AppModule { }
TBD...