Aurelia - 外部需求

Aurelia - External Requires

对 Aurelia 是全新的,并开始爱上它。但是,我对如何将外部 URL 包含到视图中感到困惑。例如,

<template>
  <require from="css/bootstrap/bootstrap.css"></require>
  <require from="fonts/font-awesome-4/css/font-awesome.css"></require>
  <require from="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,400italic,700,800"></require>
  <require from="http://fonts.googleapis.com/css?family=Raleway:300,200,100"></require>
  <require from="css/style.css"></require>

  <div class="page-host">
    <router-view></router-view>
  </div>
</template>

我一直收到错误消息:

Uncaught SyntaxError: Unexpected token ILLEGAL
Evaluating http://fonts.googleapis.com/css?family=Raleway:300,200,100.js
Error loading http://fonts.googleapis.com/css?family=Raleway:300,200,100.js

我对外部 CSS 或 JS 文件的要求是否错误?

require 标签正在尝试加载 Aurelia ViewModel,而不仅仅是进行通用文本导入。

由于 Aurelia 是单页应用程序,因此很可能使用传统的 HTML 方法从 index.html 内部加载外部 CSS / 字体,并且您仍然可以访问向他们表达你的其他看法。

如果你看一下 skeleton app 他们就是这样做的。