atticoos / gulp-ng-config

:wrench: Create AngularJS constants from a JSON config file
MIT License
173 stars 35 forks source link

Defined constants are dropped if using environment specific configurations #21

Closed danwkennedy closed 9 years ago

danwkennedy commented 9 years ago

I'm using the constants option to inject build info into Angular (latest commit SHA, branch, tag...) and I'm also using environment dependent configurations.

config.json

{
     "prod": {},
     "dev": {}
}

And in gulpFile.js:

   gulp
       .src(appPath + '/config.json')
       .pipe(gulpNgConfig('app.config', {
            environment: args.environment,
            constants: {
                environment: args.environment,
                buildInfo: buildInfo
            }
        }))
        .pipe(gulp.dest(appPath));

Right now, the environment dependent configs win over constants and the generated config omits "environment" and "buildInfo". I've figured out what the issue was and it was a very simple fix. Creating a PR for it.

atticoos commented 9 years ago

Thanks!

danwkennedy commented 9 years ago

It's in and unit tested

atticoos commented 9 years ago

This has been published as part of v1.2.0