Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

CSS doesn't link when generating default HTML format #95

Closed
captainbarbosa opened this issue Apr 28, 2020 · 3 comments
Closed

CSS doesn't link when generating default HTML format #95

captainbarbosa opened this issue Apr 28, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@captainbarbosa
Copy link

Hi @mattt! Great project. I was poking around and testing the --format html option and noticed the all.css file isn't linking properly to the generated index.html file.

I tried debugging this myself, first by checking index.html where it seems to be linked correctly (however I'm not a web developer):

<link rel="stylesheet" type="text/css" href="all.css" media="all" />

But when I check out the network console in my browser, it looks like all.css is failing:

image

Any idea what could be happening? I'm using 1.0.0-beta.2.

@captainbarbosa
Copy link
Author

Oh, I think I may have found the cause.

It appears this base-href line is causing the file search path for all.css be incorrect:

Index.html

<head>
    ...
    <base href="/"/>
    <link rel="stylesheet" type="text/css" href="all.css" media="all" />
</head>

Changing this from <base href="/"/> to <base href=""/> fixes the issue, so I think we just need to swap the ordering of these two lines:

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

I created a pull request for this in #96.

@mattt mattt added the bug Something isn't working label Apr 30, 2020
@mattt
Copy link
Contributor

mattt commented Apr 30, 2020

Thanks again for bringing this to our attention, @captainbarbosa. I'll keep this open until after #93 is merged, so that you can confirm the fix for yourself.

@BilalReffas
Copy link

Hi @mattt thanks for this great project!
Just wanted to raise that I'm running into this issue as well. I have ´swift-doc 1.0.0-beta.3´ installed on my machine.

@mattt mattt closed this as completed Sep 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants