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
But I think you can choose different Firebase more simply with [gulp-ng-constant](https://www.npmjs.com/package/gulp-ng-constant)
5
+
`generator-gulp-angular` does not yet have a way to build for different environments.
7
6
7
+
One way to do this is with [gulp-ng-constant](https://www.npmjs.com/package/gulp-ng-constant):
8
+
9
+
#### 1) Create a new gulp task called `config`.
10
+
11
+
This reads in the configuration in either `config.json` or `configDev.json`, based on the `NODE_ENV` environment variable and generates an Angular module with the contents to be included in your application.
8
12
9
-
#### 1) create a new task `config`
10
13
```javascript
11
14
gulp.task('config', function () {
12
15
var configPath ='config.json';
13
-
if (process.env.NODE_ENV==='test') {
14
-
configPath ='configTest.json';
16
+
if (process.env.NODE_ENV==='dev') {
17
+
configPath ='configDev.json';
15
18
}
16
19
returngulp.src(configPath)
17
20
.pipe($.ngConstant())
18
21
.pipe(gulp.dest('src/app/'));
19
22
});
20
23
```
21
-
#### 2) add config as a dependency of scripts
24
+
25
+
*configDev.json*
26
+
```json
27
+
{
28
+
"name": "myApp.config",
29
+
"constants": {
30
+
"config": {
31
+
"apiBase": "https://localhost/v1"
32
+
}
33
+
}
34
+
}
35
+
```
36
+
37
+
*config.json*
38
+
```json
39
+
{
40
+
"name": "myApp.config",
41
+
"constants": {
42
+
"config": {
43
+
"apiBase": "https://api.example.com/v1"
44
+
}
45
+
}
46
+
}
47
+
```
48
+
49
+
#### 2) Add the `config` gulp task as a dependency of `scripts`.
0 commit comments