我尝试从org.combined.js
文件夹中的所有脚本创建org.combined.min.js
(<Project>/org
)个文件而没有与R.JS的相关性,编译器不应该尝试解析requirejs调用<他只是为了现在(我可能想在以后启用它,现在它的条件依赖关系,这会阻碍rjs)。
我努力工作
文件结构:
<Project>
/node_modules/.bin/r.js + r.js.cmd
/node_modules/requirejs/...
/build/rjs.options.js
/build/buildScript.cmd
/dist/ >>> where all output should be generated to
/scripts/ <some system level scripts, loaders, which should not be affected>
/scripts/org/ <some framework scripts, which need to be combined and minified and put into dist/scripts
重点说明要做的事情:文件夹内的脚本&#34; org&#34;应该缩小:
<Project>/scripts/not-to-be-combined1.js
..
<Project>/scripts/not-to-be-combinedN.js
<Project>/scripts/org
<Project>/scripts/org/to-be-combined1.js
...
<Project>/scripts/org/to-be-combinedN.js
将rjs.options.js中的findNestedDependencies设置为false。配置rjs.options.js:
{
appDir: '../',
baseUrl : './scripts/',
mainConfigFile : 'org.loader.config.js',
//out: 'dist/org.combined.js',
//dir: 'dist/scripts',
findNestedDependencies: false,
}
r.js的文档非常糟糕和复杂,每个选项都取决于其他选项,使用对我来说根本不透明。我有时会得到合并文件,但它没有被缩小。
我在Visual Studio中使用NodejsTools,因此WebEssentials在这里不起作用/帮助。最好是利用npm的解决方案,是否有可选的可视化器,上下文菜单的帮助器,或者它只是命令行?
我已经看过其他选项,例如node-minify,但是我已经锁定了自己的智能 requirejs指令感知编译,所以必须完成与rjs。感谢。
其他尝试:
{
baseUrl: '../scripts/',
mainConfigFile: '../scripts/org.loader.config.js',
dir: '../dist', //scripts,
findNestedDependencies: false,
modules: [
{
//module names are relative to baseUrl
name: '/dist/org.framework',
//List common dependencies here. Only need to list
//top level dependencies, "include" will find
//nested dependencies.
include: [
'org/org.core',
...
'org/org.dialogs'
]
}
]
}