Skip to content

--extend-css option refers to ../static.files/theme.css but puts css in ../theme.css #2095

Closed
@monkeydom

Description

@monkeydom

When adding an --extend-css file, it seems that the file gets copied to the wrong location or that it is referenced incorrectly.

Steps:

> cargo new --lib ecss
     Created library `ecss` package
> cd ecss
> cat >custom.css <<<"body {background: red;}"
> RUSTDOCFLAGS="--extend-css $PWD/custom.css" cargo doc --open

Expected Results:

Red background in docs

Actual Results:

No red background

Notes:

Moving the theme.css to static.files/theme.css fixes the issue

> cp target/doc/theme.css target/doc/static.files/

Just for reference, this is the cmd line cargo generates:

rustdoc --edition=2021 --crate-type lib --crate-name ecss src/lib.rs -o /Users/dom/Data/Playground/rust/ecss/target/doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=115 -C metadata=b5a7f46f1030585c -L dependency=/Users/dom/Data/Playground/rust/ecss/target/debug/deps --extend-css /Users/dom/Data/Playground/rust/ecss/custom.css --crate-version 0.1.0

and the header line in the index.html

<link rel="stylesheet" href="../static.files/theme.css">

Context & Version

> rustdoc --version
rustdoc 1.68.2 (9eb3afe9e 2023-03-27)

> sw_vers
ProductName:		macOS
ProductVersion:		13.3
BuildVersion:		22E252

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions