Skip to content

Remove rustdoc CSS files import from non-rustdoc pages #1146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

{# Docs.rs styles #}
<link rel="stylesheet" href="/-/static/vendored.css?{{ docsrs_version() | slugify }}" type="text/css" media="all" />
<link rel="stylesheet" href="/normalize-{{ rustc_resource_suffix() }}.css" type="text/css" media="all" />
<link rel="stylesheet" href="/rustdoc-{{ rustc_resource_suffix() }}.css" type="text/css" media="all" />
<link rel="stylesheet" href="/light-{{ rustc_resource_suffix() }}.css" type="text/css" media="all" />
<link rel="stylesheet" href="/-/static/style.css?{{ docsrs_version() | slugify }}" type="text/css" media="all" />

{%- block css -%}{%- endblock css -%}
Expand Down
103 changes: 102 additions & 1 deletion templates/style/base.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,56 @@
// FIXME: Use modules
@import "vars", "utils", "navbar", "themes", "fa";

/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@font-face {
font-family: 'Fira Sans';
font-style: normal;
font-weight: 400;
src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those files are from the rustdoc essential files, which means starting an instance locally without building something before will result in broken styling.

I'm wondering if it's worth putting them in /-/static/fonts or something.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the most stable part of rustdoc. They were here before I came in and they haven't changed since then. So moving them in a "static" location seems safe enough.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GuillaumeGomez I think pietro means that the files won't appear at all unless you run a build first. It would be nice to be able to use Fira Sans without having to first run a rustdoc build.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see! Sending a PR shortly then.

}
@font-face {
font-family: 'Fira Sans';
font-style: normal;
font-weight: 500;
src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
}

/* See SourceSerifPro-LICENSE.txt for the Source Serif Pro license. */
@font-face {
font-family: 'Source Serif Pro';
font-style: normal;
font-weight: 400;
src: local('Source Serif Pro'), url("SourceSerifPro-Regular.ttf.woff") format('woff');
}
@font-face {
font-family: 'Source Serif Pro';
font-style: italic;
font-weight: 400;
src: local('Source Serif Pro Italic'), url("SourceSerifPro-It.ttf.woff") format('woff');
}
@font-face {
font-family: 'Source Serif Pro';
font-style: normal;
font-weight: 700;
src: local('Source Serif Pro Bold'), url("SourceSerifPro-Bold.ttf.woff") format('woff');
}

/* See SourceCodePro-LICENSE.txt for the Source Code Pro license. */
@font-face {
font-family: 'Source Code Pro';
font-style: normal;
font-weight: 400;
/* Avoid using locally installed font because bad versions are in circulation:
* see https://github.com/rust-lang/rust/issues/24355 */
src: url("SourceCodePro-Regular.woff") format('woff');
}
@font-face {
font-family: 'Source Code Pro';
font-style: normal;
font-weight: 600;
src: url("SourceCodePro-Semibold.woff") format('woff');
}

html,
input,
select,
Expand All @@ -25,12 +75,62 @@ body {
padding: 0;
margin: 0;

* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

h1 {
font-size: 1.5em;
}
h3 {
font-size: 1.3em;
}
h1, h2, h3, h4 {
font-family: "Fira Sans",sans-serif;
font-weight: 500;
margin: 20px 0 15px 0;
padding-bottom: 6px;
}
h2, h3, h4 {
border-bottom: 1px solid;
}
pre {
background-color: #F5F5F5;
padding: 14px;
}
code, kbd, pre, samp {
font-family: "Source Code Pro",monospace;
}
a {
text-decoration: none;
background: transparent;
}
p {
margin: 0 0 .6em 0;
}
ol, ul {
padding-left: 25px;
}

input, #search {
background-color: var(--color-background-input);
color: var(--input-color);
line-height: normal;
}

#search {
-moz-box-sizing: border-box !important;
box-sizing: border-box !important;
outline: none;
border: none;
border-radius: 1px;
margin-top: 5px;
padding: 10px 16px;
font-size: 17px;
width: 100%;

box-shadow: 0 0 0 1px var(--color-border), 0 0 0 1px var(--color-border);
transition: box-shadow 150ms ease-in-out;
}
Expand Down Expand Up @@ -89,7 +189,8 @@ div.landing {

h1.brand {
font-size: 3em;
margin-bottom: 10px;
margin: 20px 0 10px 0;
padding-bottom: 6px;
color: var(--color-brand);
}

Expand Down