LDJ
LDJ

Reputation: 7304

Aurelia: Stylesheets not being requested

I'm re-building my website using Aurelia as a learning exercise having previously followed the tutorial on the official website without issue. However, I want to load an existing local (to the project) stylesheet but for some reason they aren't being requested/loaded by the framework.

I have a standard CSS link in my index.html file:

<link rel="stylesheet" type="text/css" src="styles/base.css" />

and when I load my site in a browser I can see from the dev tools that the declaration is there. if I right click the resource and say 'open in new tab' then it loads the stylesheet fine, so the path is OK. Looking at the network tab though, its not being requested at all. I've tried moving the line from index.html to app.html but it makes no difference.

Looking at the docs (http://aurelia.io/docs.html#templating) it says you can import a stylesheet outside of a template tag, but again I've tried this and it isn't making the request for the CSS file.

Is there some bespoke means of loading a stylesheet in Aurelia that I'm missing?

Upvotes: 1

Views: 797

Answers (1)

Bryan
Bryan

Reputation: 3492

The link element doesn't have a src attribute. I think you just need to switch to the href attribute instead.

<link rel="stylesheet" type="text/css" href="styles/base.css" />

Upvotes: 3

Related Questions