diff --git a/README.md b/README.md index 6a09ccd..3835c54 100644 --- a/README.md +++ b/README.md @@ -225,33 +225,6 @@ Location of a custom template file for creating the output configuration file. D ## Examples -### Multiple Environments - -_**config.json**_ -```json -{ - "development": { "greeting": "Sup!" }, - "production": { "greeting": "Hello" } -} -``` - -_**gulpfile.js**_ -```javascript -var gulp = require('gulp'); -var ngConstant = require('gulp-ng-constant'); - -gulp.task('constants', function () { - var myConfig = require('./config.json'); - var envConfig = myConfig[process.env]; - return ngConstant({ - constants: envConfig, - stream: true - }) - .pipe(gulp.dest('dist')); -}); - -``` - ### Stream ```javascript diff --git a/index.js b/index.js index 4234852..5a23b8d 100644 --- a/index.js +++ b/index.js @@ -46,7 +46,9 @@ function ngConstantPlugin(opts) { try { var data = file.isNull() ? {} : yaml.safeLoad(file.contents); - + + data = options.namespace ? data[options.namespace] : data; + // Create the module string var result = _.template(template)({ moduleName: getModuleName(data, options, file), diff --git a/package.json b/package.json index 81986ce..e0a26a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-ng-constant", - "version": "1.1.0", + "version": "1.1.1", "description": "Gulp plugin for dynamic generation of angular constant modules.", "main": "index.js", "repository": {