使用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.js
和app.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', []);
这里发生了什么?
答案 0 :(得分:0)
而不是这个,
&#39;!公共/ Javascript角/环境/ ** / * JS&#39;
尝试:
&#39;公共/ Javascript角/环境/(** / *)JS&#39;!