导入CSS并控制< head>中的顺序使用jspm和system.js [英] Importing CSS and controlling order in <head> using jspm and system.js
问题描述
我已经在Aurelia应用中编写了以下内容
I've written the following in an Aurelia app
import "bootstrap/css/bootstrap.css!";
import "./app.css!";
,我想加入app.css,因为它覆盖了bootstrap.css样式.但是,我首先获得了app.css,因为我假设system.js加载程序正在并行运行它们,并且因为app.css是两者中的较小者,所以它首先被加载.
and I want app.css second in since it overrides bootstrap.css styles. However, I'm getting app.css first since I presume the system.js loader is running them in parallel and since app.css is the smaller of the two it gets loaded first.
jspm中是否有一种方法可以定义这两个文件之间的依赖关系来控制其加载顺序?
Is there a way in jspm to define a dependency between these two files to control their loading order is is there some other way?
非常感谢! :)
推荐答案
您可以尝试使用System.import导入CSS. 例如.在您的index.html中:
You could try to import the css using System.import. E.g. in your index.html:
System.import('bootstrap/css/bootstrap.css!').then(() => {
System.import('./app.css!');
});
但是请记住,通过这种方式,您必须确保将system.js与您的应用一起提供.因此,您不能将整个应用程序捆绑为一个自动执行的捆绑包.
But keep in mind that this way you have to make sure that system.js is served with your app. So you can't bundle your whole app as an self-executing bundle.
这篇关于导入CSS并控制< head>中的顺序使用jspm和system.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!