-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Description
First of all, thanks for this project. It was an inspiration and a good resource for me to build the @ngx-env/builder.
I suggest to add @ngx-env/builder 👇 to the list of builders.
Usage
- Add @ngx-env to your CLI project
ng add @ngx-env/builder- Define Environment Variables in
.env
NG_APP_ENABLE_ANALYTICS=false
NG_APP_VERSION=$npm_package_version
NG_APP_COMMIT=$GITHUB_SHA- Use in TS and HTML
@Component({
selector: "app-footer",
})
export class FooterComponent {
version = process.env.NG_APP_VERSION;
branch = process.env.NG_APP_BRANCH_NAME;
commit = process.env.NG_APP_COMMIT;
analyticsFlag = process.env.NG_APP_ENABLE_ANALYTICS;
}<!-- Same output in the spans -->
<span> {{ 'process.env.NG_APP_BRANCH_NAME' | env }} </span>
<span> {{ 'NG_APP_BRANCH_NAME' | env }} </span>
<span> {{ branch }} </span><!-- index.html -->
<head>
<title>NgApp on %NG_APP_BRANCH_NAME%</title>
</head>- Run your CLI commands
npm start
NG_APP_BRANCH_NAME=$GITHUB_HEAD_REF ng test
NG_APP_BRANCH_NAME=`git branch --show-current` npm run buildDocumentation
Links
And please let me know if you think about any good feature to add to the project. 💙
Metadata
Metadata
Assignees
Labels
No labels