【发布时间】:2015-10-02 09:09:55
【问题描述】:
编辑
问题似乎在于 brocfile.js 而不是迁移到 ember-cli-build.js。本文一扫而光:https://github.com/ember-cli/ember-cli/blob/master/TRANSITION.md.
我正在学习 ember-cli 101 教程,我们应该从 picnic 和 fontello 获取资产,但如果我转到 http://localhost:4200/assets/vendor.css,资产不会被识别/加载。事实上,如果我去那里,Ember 控制台根本不会检测到 Ember 应用程序。
我认为这可能与我所做的内容安全政策更改有关,只是为了使其不会引发违规行为:
config/environment.js:
contentSecurityPolicy: {
'default-src': "'none'",
'script-src': "'self' 'unsafe-inline' 'unsafe-eval'",
'font-src': "'self'",
'connect-src': "'self'",
'img-src': "'self'",
'style-src': "'self' 'unsafe-inline'",
'frame-src': "'none'"
}
Brocfile.js:
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp({});
app.import('vendor/fontello/fontello.css');
app.import('vendor/fontello/font/fontello.ttf', {
destDir: 'assets/fonts'
});
app.import('vendor/fontello/font/fontello.eot', {
destDir: 'assets/fonts'
});
app.import('vendor/fontello/font/fontello.svg', {
destDir: 'assets/fonts'
});
app.import('vendor/fontello/font/fontello.woff', {
destDir: 'assets/fonts'
});
app.import('bower_components/picnic/releases/plugins.min.css');
app.import('bower_components/picnic/releases/picnic.min.css');
module.exports = app.toTree();
Bower.json includes:
"picnic": "~3.3.1"
我的目录结构是:
Brocfile.js
bower_components
--> picnic
bower.json
vendor
--> fontello
--> font
--> fontello.eot / .svg .ttf .woff
教程的源代码在这里:https://github.com/abuiles/borrowers。
是的,我通过 Bower 安装并重新启动了服务器。
【问题讨论】:
-
这不是 Ember 的错,SPA 具有更困难的抽象层。我想我也面临同样的问题,brb。
-
也许只是野餐。我不知道。我必须学习 SPA,但发现它们并不容易上手。
标签: javascript ember.js