简体   繁体   中英

grunt-contrib-concat not including certain file

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?

Instead of this,

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

Try:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM