如何在Durandal应用程序中构建main-build.js
文件?这是我所指的文件:
exports.config = function(weyland) {
weyland.build('main')
.task.jshint({
include:'App/**/*.js'
})
.task.uglifyjs({
include:['App/**/*.js', 'Scripts/durandal/**/*.js']
})
.task.rjs({
include:['App/**/*.{js,html}', 'Scripts/durandal/**/*.js'],
loaderPluginExtensionMaps:{
'.html':'text'
},
rjs:{
name:'../Scripts/almond-custom', //to deploy with require.js, use the build's name here instead
insertRequire:['main'], //not needed for require
baseUrl : 'App',
wrap:true, //not needed for require
paths : {
'text': '../Scripts/text',
'durandal': '../Scripts/durandal',
'plugins': '../Scripts/durandal/plugins',
'transitions': '../Scripts/durandal/transitions',
'knockout': 'empty:',
'bootstrap': 'empty:',
'jquery': 'empty:'
},
inlineText: true,
optimize : 'none',
pragmas: {
build: true
},
stubModules : ['text'],
keepBuildDir: true,
out:'App/main-built.js'
}
});
}
我已经查看了this页面(与Weyland一起建设),但这还不够。
答案 0 :(得分:2)
您需要安装node.js
,然后全局安装weyland npm模块。要构建main-build.js
文件,请导航到项目的根目录并运行weyland
和命令提示符(这假定您的weyland-build.js
文件位于同一文件夹中。)