Aurelia - 外部要求

时间:2015-12-09 18:49:27

标签: aurelia

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

<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文件执行了错误的操作?

1 个答案:

答案 0 :(得分:4)

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

由于Aurelia是单页应用程序,因此很有可能使用传统的HTML方法从index.html内部加载外部CSS /字体,您仍然可以在其他视图上访问它们。 / p>

如果您看一下skeleton app,那就是他们如何做到这一点。

相关问题