我相信这仍然是 Ember CLI 的一项工作,并计划在未来的版本中发布,或者取决于 Broccoli 中的修复。见https://github.com/stefanpenner/ember-cli/issues/2371
我为解决这个问题所做的工作可能并不理想,但我最终使用 grunt,并使用 shell 命令运行ember build,将输出复制到另一个服务器正在服务的不同目录(在我的情况下是 IIS express),然后手动查看我的文件。
这是我的 grunt 文件中的 sn-ps。我相信你可以使用 Gulp 完成同样的任务。
shell: {
prod: {
command: 'ember build --environment production'
},
dev: {
command: 'ember build'
}
},
copy: {
dev: {
files: [{
src: '**',
dest: '../Server/Content/js',
cwd: 'dist/content/js',
expand: true
}, {
src: '**',
dest: '../Server/content/css',
cwd: 'dist/content/css',
expand: true
}, {
src: 'dist/index.html',
dest: '../Server/Views/Home/Root.cshtml'
}]
}
},
watch: {
dev: {
files: [
'app/**/*.js', 'app/**/*.hbs'
],
tasks: ['_buildDev'],
options: {
livereload: true
}
},
less: {
files: [
'app/**/*.less'
],
tasks: ['shell:dev', 'copy:dev']
},
css: {
files: [
'../Server/Content/css/**/*'
],
options: {
livereload: true
}
}
}