Javascript RequireJS优化器和VS 2010 Itegration
我想知道是否有任何VS 2010扩展用于触发requirejs优化,类似于squishit的工作方式:Javascript RequireJS优化器和VS 2010 Itegration,javascript,visual-studio-2010,requirejs,amd,squishit,Javascript,Visual Studio 2010,Requirejs,Amd,Squishit,我想知道是否有任何VS 2010扩展用于触发requirejs优化,类似于squishit的工作方式: 在调试模式下,模块文件保持分离 在发布模式下,模块文件将缩小并合并 编辑:我们使用VS2012,但一般原则应该有效 虽然这不是对您问题的直接回答,但这是我们提出的解决方案: 为要最小化和绑定的文件创建一个模块。为了便于讨论,将其命名为base\u模块 在\u layout.cshtml function requireBaseModulesDebug(func) { // In de
- 在调试模式下,模块文件保持分离
- 在发布模式下,模块文件将缩小并合并
base\u模块
在\u layout.cshtml
function requireBaseModulesDebug(func) {
// In debug mode, just execute the call back directly.
// Do not load any base modules, require each module to fully state any dependencies.
func();
}
function requireBaseModulesRelease(func) {
require(["js_modules/base_module"], func);
}
// Views are always in DEBUG mode, so we have to this this work-around.
@if (HttpContext.Current.IsDebuggingEnabled)
{
<text>requireBaseModules = requireBaseModulesDebug;</text>
}
else
{
<text>requireBaseModules = requireBaseModulesRelease;</text>
}
// If you are in DEBUG mode, requireBaseModules won't do anything
// But, if you are in a release mode, then requireBaseModules will load your
// bundled module and have them primed. Any modules required but NOT in your
// base bundle will be loaded normally.
requireBaseModules(function () {
require(['jQuery'], function ($) {
// Do Stuff
});
});