The recommended way of configuring beagle for Angular is using beagle init
. Still if, for some reason, you can't use beagle init
, you can follow the steps below to manually set
Beagle up.
-
create the file
beagle-components.module.ts
undersrc/app
with the@NgModule
containing all the components you wish to use with Beagle. -
create the file
beagle.module.ts
undersrc/app
with your@BeagleModule
containing all the configuration for Beagle. -
Install
ts-node
andamd-loader
as dev dependencies:yarn add -D ts-node amd-loader
ornpm install -D ts-node amd-loader
. -
Create the scripts
serve
andbuild
in yourpackage.json
:
scripts: {
"serve": "yarn beagle view-engine && ng build --prod",
"build": "yarn beagle view-engine && ng serve"
}
If you're using npm:
scripts: {
"serve": "npx beagle view-engine --npm && ng build --prod",
"build": "npx beagle view-engine --npm && ng serve"
}
- In your
angular.json
file, create the following entries in your project's configuration:
"architect": {
"options": {
"fileReplacements": [
{
"replace": "src/app/beagle.module.ts",
"with": "src/app/.beagle.module.generated.ts"
}
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/app/beagle.module.ts",
"with": "src/app/.beagle.module.generated.ts"
}
]
}
}
}
-
Add
src/app/.beagle.module.generated.ts
andsrc/app/.beagle.module.original.ts
to your.gitignore
-
Done! You should always use
yarn serve/build
ornpm run serve/build
instead ofng serve/build
.