grunt-contrib-concat不包括某些文件

时间:2014-05-05 01:06:17

标签: javascript gruntjs grunt-contrib-concat

使用NODE_ENV=development grunt命令时,grunt-contrib-concat不会连接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']);
};

如果我从第6行删除!public/javascripts/environments/**/*.js,我的两个特定于环境的文件(app.development.jsapp.production.js)会被连接起来,如下所示:

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', []);

这里发生了什么?

1 个答案:

答案 0 :(得分:0)

而不是这个,

  

&#39;!公共/ Javascript角/环境/ ** / * JS&#39;

尝试:

  

&#39;公共/ Javascript角/环境/(** / *)JS&#39;!