[英]Aurelia - External Requires
Brand new to Aurelia, and beginning to fall in love with it. Aurelia的新手,并开始爱上它。 I'm confused about how to include external URL's into a view however.
但是,我对如何在视图中包括外部URL感到困惑。 For instance,
例如,
<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>
I keep getting the error: 我不断收到错误:
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
Am I doing the require wrong for an external CSS or JS file? 我是否对外部CSS或JS文件执行了require错误?
The require tag is trying to load an Aurelia ViewModel, not just doing a generic text import. require标签正在尝试加载Aurelia ViewModel,而不仅仅是执行常规文本导入。
As Aurelia is a Single Page Application, it's quite possible to load the external CSS / fonts from inside your index.html using the traditional HTML methods and you will still have access to them on your other views. 由于Aurelia是单页应用程序,因此很有可能使用传统的HTML方法从index.html内部加载外部CSS /字体,并且您仍然可以在其他视图上访问它们。
If you take a look at the skeleton app that's precisely how they do it. 如果您看一下骨架应用程序 ,这正是他们的工作方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.