title: Replacement attribute expected in pattern definition
body: <p>I have a Gulp task <code>build:env</code> that generates an <code>app.constant.js</code> file for my AngularJS application. But the commands results with the error:</p>
  
  <pre><code>/home/myuser/Documents/Projects/myapp/node_modules/gulp-replace-task/node_modules/applause/src/applause.js:82
          throw new Error('Replacement attribute expected in pattern definition.
                ^
  Error: Replacement attribute expected in pattern definition.
    at /home/myuser/Documents/Projects/myapp/node_modules/gulp-replace-task/node_modules/applause/src/applause.js:82:15
    at /home/myuser/Documents/Projects/myapp/node_modules/gulp-replace-task/node_modules/applause/node_modules/lodash/dist/lodash.js:2885:18
    at forEach (/home/myuser/Documents/Projects/myapp/node_modules/gulp-replace-task/node_modules/applause/node_modules/lodash/dist/lodash.js:3297:15)
    at Function.transform (/home/myuser/Documents/Projects/myapp/node_modules/gulp-replace-task/node_modules/applause/node_modules/lodash/dist/lodash.js:2884:35)
    at normalize (/home/myuser/Documents/Projects/myapp/node_modules/gulp-replace-task/node_modules/applause/src/applause.js:43:12)
    ...etc
  </code></pre>
  
  <p>Below all files that are used and also the output of the console from the <code>gulpfile.js</code> where you can see the settings are loaded correctly.</p>
  
  <p><strong>.env.json</strong></p>
  
  <pre><code>{
      "active": "dev"
  }
  </code></pre>
  
  <p><strong>environments.json</strong></p>
  
  <pre><code>{
      "demo": {
          "frontend": {
              "host": "app.demo.example.org",
              "protocol": "https",
              "port": "443",
              "endpoint": null
          },
          "backend": {
              "host": "api.demo.example.org",
              "protocol": "https",
              "port": "443",
              "endpoint": {
                  "api": "api/"
              }
          },
          "socket": {
              "host": "socket.demo.example.org",
              "protocol": "https",
              "port": "443",
              "endpoint": null
          }
      },
      "dev": {
          "frontend": {
              "host": "app.dev.example.org",
              "protocol": "https",
              "port": "443",
              "endpoint": null
          },
          "backend": {
              "host": "api.dev.example.org",
              "protocol": "https",
              "port": "443",
              "endpoint": {
                  "api": "api/"
              }
          },
          "socket": {
              "host": "socket.dev.example.org",
              "protocol": "https",
              "port": "443",
              "endpoint": null
          }
      }
  }
  </code></pre>
  
  <p><strong>gulpfile.js</strong> <em>(task build:env)</em></p>
  
  <pre><code>gulp.task('build:env', function () {
      var env = JSON.parse(fs.readFileSync('./.env.json', 'utf8'));
      var environments = JSON.parse(fs.readFileSync('./.environments.json', 'utf8'));
      var settings = environments[env.active];
      console.log(settings);
  
      // Replace each placeholder with the correct value for the variable.
      return gulp.src('./config/app.constant.js')
      .pipe(replace({
          patterns: [
              {
                  match: 'api',
                  replacement: settings.backend.host
              },
              {
                  match: 'assets',
                  replacement: settings.frontend.host
              }
          ]
      }))
      .pipe(gulp.dest('./www/app'));
  });
  </code></pre>
  
  <p><strong>config/app.constant.js</strong></p>
  
  <pre><code>(function() {
      'use strict';
      angular.module('myapp').constant('settings', {
      'API': '@@api',
      'ASSETS': '@@assets'
      });
  }());
  </code></pre>
  
  <p><strong>console.log(settings)</strong></p>
  
  <pre><code>{
     frontend:{
        host:'192.168.1.112',
        protocol:'http',
        port:'8100',
        endpoint:null
     },
     backend:{
        host:'192.168.1.112',
        protocol:'http',
        port:'80',
        endpoint:{
       api:'api/'
        }
     },
     socket:{
        host:'192.168.1.112',
        protocol:'http',
        port:'3001',
        endpoint:null
     }
  }
  </code></pre>
  
  <p><strong>Ionic/NodeJS/Cordova/Gulp</strong></p>
  
  <pre><code>myuser@my-laptop:~/Documents/Projects/frontend$ ionic info
  
  Your system information:
  
  Cordova CLI: 5.3.3
  Gulp version:  CLI version 3.8.11
  Gulp local:   Local version 3.9.0
  Ionic Version: 1.1.0
  Ionic CLI Version: 1.7.7
  Ionic App Lib Version: 0.6.3
  OS: Distributor ID:     Ubuntu Description:     Ubuntu 15.04 
  Node Version: v0.12.7
  </code></pre>
  
  <p><strong>List of dependencies</strong></p>
  
  <pre><code>myuser@my-laptop:~/Documents/Projects/frontend$ npm list --depth 0
  frontend@0.0.1 /home/myuser/Documents/Projects/frontend
  ├── async@0.9.2
  ├── bower@1.6.3
  ├── clean-css@2.2.23
  ├── del@1.2.1
  ├── gulp@3.9.0
  ├── gulp-angular-templatecache@1.8.0
  ├── gulp-concat@2.6.0
  ├── gulp-cordova-bump@1.3.0
  ├── gulp-minify-css@0.3.13
  ├── gulp-ng-annotate@1.1.0
  ├── gulp-rename@1.2.2
  ├── gulp-replace-task@0.1.0
  ├── gulp-sass@1.3.3
  ├── gulp-useref@1.3.0
  ├── gulp-util@2.2.20
  ├── jshint@2.8.0
  ├── mv@2.1.1
  ├── ng-annotate@0.15.4
  ├── q@1.4.1
  ├── shelljs@0.3.0
  ├── uglify-js@2.4.14
  └── yargs@1.3.3
  </code></pre>