0

When using the command NODE_ENV=development grunt, grunt-contrib-concat isn't concatenating public/javascripts/environments/app.development.js.

module.exports = function (grunt) {
  grunt.initConfig({
    env: process.env.NODE_ENV,
    src: {
      config: ['public/javascripts/environments/app.<%= env %>.js'],
      javascripts: ['public/javascripts/**/*.js', '!public/javascripts/environments/**/*.js']
    },
    concat: {
      javascript: {
        src: ['<%= src.config %>', '<%= src.javascripts %>'],
        dest: 'app.full.js'
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-concat');

  grunt.registerTask('default', ['concat:javascript']);
};

If I remove !public/javascripts/environments/**/*.js from line 6, both of my environment-specific files (app.development.js and app.production.js) get concatenated, like so:

angular.module('realscout').constant('API_BASE_URL', 'http://localhost:3000'); // <-- `app.development.js`

angular.module('realscout', [
  'realscout.services'
]);


angular.module('realscout').constant('API_BASE_URL', 'http://api.realscout.com/v3'); // <-- `app.production.js`
angular.module('realscout.services', [
  'realscout.services.property'
]);

angular.module('realscout.services.property', []);

What's going on here?

James Brewer
  • 1,745
  • 14
  • 17

1 Answers1

0

Instead of this,

'!public/javascripts/environments/**/*.js'

Try:

'public/javascripts/environments/!(**/*).js'

Vageesh Bhasin
  • 553
  • 2
  • 12