我有一个需要多个JS文件的项目。一些用例:
似乎ember cli允许多个CSS文件,但不允许多个JS文件:
venter code herear app = new EmberApp({
outputPaths: {
app: {
js: {
app: '/assets/app.js',
ie: '/assets/ie.js'
}
}
}
});
错误:
Object #<Object> has no method 'slice'
TypeError: Object #<Object> has no method 'slice'
at module.exports (/Users/<me>/Projects/<my-app>/node_modules/ember-cli/node_modules/broccoli-sourcemap-concat/index.js:15:30)
at EmberApp.concatFiles (/Users/<me>/Projects/<my-app>/node_modules/ember-cli/lib/broccoli/ember-app.js:261:10)
at EmberApp.javascript (/Users/<me>/Projects/<my-app>/node_modules/ember-cli/lib/broccoli/ember-app.js:864:16)
at EmberApp.toArray (/Users/<me>/Projects/<my-app>/node_modules/ember-cli/lib/broccoli/ember-app.js:1159:10)
at EmberApp.toTree (/Users/<me>/Projects/<my-app>/node_modules/ember-cli/lib/broccoli/ember-app.js:1181:30)
at Object.<anonymous> (/Users/<me>/Projects/<my-app>/Brocfile.js:35:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
指南中没有关于供应商以外的多个JS文件的内容;我有什么遗漏或者这是一个缺失的功能吗?
答案 0 :(得分:-1)
编辑app/index.html
并将要加载的脚本的路径添加到其他脚本之上。看起来应该是这样的:
<!--[if lt IE 8]>
<script src="assets/polyfill.js"></script>
<![endif]-->
<script src="assets/vendor.js"></script>
<script src="assets/my-application.js"></script>
要为您提供polyfill.js
文件,请将代码添加到public/assets/polyfill.js
。这将使文件静态可用。