Requirejs 如何在构建中同时使用require.js和devcode grunt任务?(约曼配置)
层次结构:Requirejs 如何在构建中同时使用require.js和devcode grunt任务?(约曼配置),requirejs,gruntjs,Requirejs,Gruntjs,层次结构: 应用程序 .tmp//temp文件 应用程序//源文件 dist//dist文件 所以如果我把devcode:build放在requirejs之前: “应用程序/脚本”中的文件将被处理并保存到“.tmp/scripts”中 Requirejs将被指向加载“.tmp/scripts” 然后失败,因为在“bower_组件”中找不到bower_组件;当然,因为bower_组件位于“应用程序/bower_组件”中 如果我颠倒顺序: Requirejs删除注释,而devcode不
- 应用程序
- .tmp//temp文件
- 应用程序//源文件
- dist//dist文件
- “应用程序/脚本”中的文件将被处理并保存到“.tmp/scripts”中
- Requirejs将被指向加载“.tmp/scripts”
- 然后失败,因为在“bower_组件”中找不到bower_组件;当然,因为bower_组件位于“应用程序/bower_组件”中
- Requirejs删除注释,而devcode不工作
谢谢我不需要devcode grunt任务,因为requirejs已经附带了uglify2,它允许您拥有dist.options.uglify2.compress.global\u defs 如果将
DEBUG=false
置于生产模式,则此代码将被删除
dist: {
options: {
baseUrl : '<%= yeoman.app %>/scripts/',
name : 'main',
mainConfigFile : '<%= yeoman.app %>/scripts/main.js',
out : '.tmp/concat/scripts/main.js',
optimize : 'uglify2',
uglify2: {
//Example of a specialized config. If you are fine
//with the default options, no need to specify
//any of these properties.
output: {
beautify: false
},
compress: {
global_defs: {
DEBUG: false
}
},
warnings : true,
mangle : true
},
}
},
dist:{
选项:{
baseUrl:“/scripts/”,
名称:'main',
mainConfigFile:“/scripts/main.js”,
输出:'.tmp/concat/scripts/main.js',
优化:“uglify2”,
丑陋2:{
//特殊配置的示例。如果您没有问题
//使用默认选项时,无需指定
//这些属性中的任何一种。
输出:{
美化:虚假
},
压缩:{
全球定义:{
调试:false
}
},
警告:正确,
芒果:是的
},
}
},