You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/README.md
+28-70Lines changed: 28 additions & 70 deletions
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,11 @@ How it works & Limitations
16
16
17
17
Environment variables are used for configuration. This package provides a script to search for usages in bundled angular files and a script for inserting populated environment variables into index.html file(s) by replacing `<!--CONFIG-->` (Missing environment variables will be represented by null). This should be done on the host serving the bundled angular files.
18
18
19
-
### AOT
19
+
### AoT
20
20
21
-
This will not work in Module.forRoot or Module.forChild scripts or parameters. These are build time only due to AOT restrictions.
21
+
By default, this will not work in Module.forRoot or Module.forChild scripts or parameters. These are build time only due to AoT restrictions.
22
+
23
+
With `ngssc wrap-aot ng build ...` it is however possible to retain the configuration, by replacing the environment variables with tokens during the AoT build and reverting afterwards. (See [CLI wrap-aot](#wrap-aot))
22
24
23
25
Getting Started
24
26
---------------
@@ -80,86 +82,42 @@ ngssc --help
80
82
```
81
83
82
84
### Insert
83
-
84
-
Usage: insert \[options\]\[directory\]
85
+
Usage: insert [options][directory]
85
86
86
87
Search and replace the placeholder with environment variables (Directory defaults to current working directory)
87
88
88
-
Options
89
-
90
-
Description
91
-
92
-
`-s, --search`
93
-
94
-
Search environment variables in available .js files (Defaults to false)
95
-
96
-
`-e, --env <value>`
97
-
98
-
Add an environment variable to be resolved (default: \[\])
99
-
100
-
`-p, --placeholder <value>`
101
-
102
-
Set the placeholder to replace with the environment variables (Defaults to `<!--CONFIG-->`)
103
-
104
-
`-h, --head`
105
-
106
-
Insert environment variables into the head tag (after title tag, if available, otherwise before closing head tag)
107
-
108
-
`--dry`
109
-
110
-
Perform the insert without actually inserting the variables
111
-
112
-
`-h, --help`
113
-
114
-
output usage information
89
+
| Options | Description |
90
+
| --- | --- |
91
+
|`-s, --search`| Search environment variables in available .js files (Defaults to false) |
92
+
|`-e, --env <value>`| Add an environment variable to be resolved (default: []) |
93
+
|`-p, --placeholder <value>`| Set the placeholder to replace with the environment variables (Defaults to `<!--CONFIG-->`) |
94
+
|`-h, --head`| Insert environment variables into the head tag (after title tag, if available, otherwise before closing head tag) |
95
+
|`--dry`| Perform the insert without actually inserting the variables |
96
+
|`-h, --help`| output usage information |
115
97
116
98
### Init
117
-
118
-
Usage: init \[options\]\[directory\]
99
+
Usage: init [options][directory]
119
100
120
101
Initialize an angular project with angular-server-side-configuration (Directory defaults to current working directory)
121
102
122
-
Options
123
-
124
-
Description
125
-
126
-
`-ef, --environment-file`
127
-
128
-
The environment file to initialize (environmentFile defaults to src/environments/environment.prod.ts)
129
-
130
-
`--npm`
131
-
132
-
Install angular-service-side-configuration via npm (Default)
133
-
134
-
`--yarn`
135
-
136
-
Install angular-service-side-configuration via yarn
137
-
138
-
`-h, --help`
139
-
140
-
output usage information
103
+
| Options | Description |
104
+
| --- | --- |
105
+
|`-ef, --environment-file`| The environment file to initialize (environmentFile defaults to src/environments/environment.prod.ts) |
106
+
|`--npm`| Install angular-service-side-configuration via npm (Default) |
107
+
|`--yarn`| Install angular-service-side-configuration via yarn |
108
+
|`-h, --help`| output usage information |
141
109
142
110
### Wrap-Aot
111
+
Usage: wrap-aot [options][ng...]
143
112
144
-
Usage: wrap-aot \[options\]\[ng...\]
145
-
146
-
Wrap an angular command with aot compilation to retain configuration (Use "ngssc wrap-aot ng build ..."). This will temporarily replace the content of the environment file with tokens. After the inner command completes, this is reverted and the tokens in the dist files will be replaced by the actual values.
147
-
148
-
Options
149
-
150
-
Description
151
-
152
-
`-ef, --environment-file`
153
-
154
-
The environment file to prepare for aot-compilation (Defaults to src/environments/environment.prod.ts)
155
-
156
-
`--dist`
157
-
158
-
The output path of the ng build (Defaults to dist/\*\*)
159
-
160
-
`-h, --help`
113
+
Wrap an angular command with aot compilation to retain configuration (Use "ngssc wrap-aot ng build ..."). This will temporarily replace the
114
+
content of the environment file with tokens. After the inner command completes, this is reverted and the tokens in the dist files will be replaced by the actual values.
161
115
162
-
output usage information
116
+
| Options | Description |
117
+
| --- | --- |
118
+
|`-ef, --environment-file`| The environment file to prepare for aot-compilation (Defaults to src/environments/environment.prod.ts) |
119
+
|`--dist`| The output path of the ng build (Defaults to dist/**) |
0 commit comments