Add print styles to Rails guides (#51458)
This updates print CSS to be more inline with the overall style. The sidebar is inlined (same as mobile), and content is 100%. Previous code in the launch from boilerplate has been struck or integrated better. * Links show in text after the original link text * Border line around code and copy button are removed * Print is now generated from SCSS to CSS via the generator that builds the other CSS files Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
This commit is contained in:
parent
f179539206
commit
76bb36c4df
@ -1,52 +0,0 @@
|
||||
/* Guides.rubyonrails.org */
|
||||
/* Print.css */
|
||||
/* Created January 30, 2009 */
|
||||
/* Modified January 31, 2009
|
||||
--------------------------------------- */
|
||||
|
||||
body, .wrapper, .note, .info, code, #topNav, .L, .R, #frame, #container, #header, #navigation, #footer, #feature, #mainCol, #subCol, .content {position: static; text-align: left; text-indent: 0; background: White; color: Black; border-color: Black; width: auto; height: auto; display: block; float: none; min-height: 0; margin: 0; padding: 0;}
|
||||
|
||||
body {
|
||||
background: #FFF;
|
||||
font-size: 10pt !important;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
color: #000;
|
||||
padding: 0 3%;
|
||||
}
|
||||
|
||||
.hide, .nav {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
background: transparent;
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
hr {
|
||||
background:#ccc;
|
||||
color:#ccc;
|
||||
width:100%;
|
||||
height:2px;
|
||||
margin:2em 0;
|
||||
padding:0;
|
||||
border:none;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5,h6 { font-family: "Helvetica Neue", Arial, "Lucida Grande", sans-serif; }
|
||||
code { font:.9em "Courier New", Monaco, Courier, monospace; display:inline}
|
||||
|
||||
img { float:left; margin:1.5em 1.5em 1.5em 0; }
|
||||
a img { border:none; }
|
||||
|
||||
blockquote {
|
||||
margin:1.5em;
|
||||
padding:1em;
|
||||
font-style:italic;
|
||||
font-size:.9em;
|
||||
}
|
||||
|
||||
.small { font-size: .9em; }
|
||||
.large { font-size: 1.1em; }
|
201
guides/assets/stylesrc/print.scss
Normal file
201
guides/assets/stylesrc/print.scss
Normal file
@ -0,0 +1,201 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
// Rails Guides Redesign - Print Styles
|
||||
//
|
||||
// Created: 29 March 2024
|
||||
// Modified: 29 March 2024
|
||||
// ---------------------------------------------------------------------------- */
|
||||
|
||||
@import 'vendor/include-media';
|
||||
|
||||
@media print {
|
||||
// remove screen UI stuff
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
background: #fff !important;
|
||||
color: #000 !important;
|
||||
/* Black prints faster */
|
||||
box-shadow: none !important;
|
||||
text-shadow: none !important;
|
||||
}
|
||||
|
||||
// Set Page layout
|
||||
@page {
|
||||
margin: 0.75in 0.25in;
|
||||
}
|
||||
|
||||
@page:left{
|
||||
@bottom-left {
|
||||
content: "Page " counter(page) " of " counter(pages);
|
||||
}
|
||||
}
|
||||
|
||||
// Include link address with linked text
|
||||
a,
|
||||
a:visited {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a[href]::after {
|
||||
content: " (" attr(href) ")";
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
background: transparent;
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
|
||||
pre, code {
|
||||
font-weight: normal !important;
|
||||
}
|
||||
}
|
||||
|
||||
abbr[title]::after {
|
||||
content: " (" attr(title) ")";
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't show links that are fragment identifiers,
|
||||
* or use the `javascript:` pseudo protocol
|
||||
*/
|
||||
a[href^="#"]::after,
|
||||
a[href^="javascript:"]::after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap !important;
|
||||
}
|
||||
|
||||
pre,
|
||||
blockquote {
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
tr,
|
||||
img {
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
p,
|
||||
h2,
|
||||
h3 {
|
||||
orphans: 3;
|
||||
widows: 3;
|
||||
}
|
||||
|
||||
h2,h3,h4,h5,h6 {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
|
||||
body.guide,
|
||||
.wrapper,
|
||||
header,
|
||||
footer,
|
||||
main,
|
||||
#feature,
|
||||
#subCol {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
position: static;
|
||||
display: block;
|
||||
float: none;
|
||||
height: auto;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
text-indent: 0;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
body.guide {
|
||||
// Force backgrounds to print
|
||||
-webkit-print-color-adjust:exact !important;
|
||||
print-color-adjust:exact !important;
|
||||
font-size: 10pt !important;
|
||||
line-height: 1.4;
|
||||
padding: 0 3%;
|
||||
|
||||
.wrapper {
|
||||
max-width: unset !important;
|
||||
padding-right: unset !important;
|
||||
}
|
||||
|
||||
.hide,
|
||||
nav {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#feature #subCol {
|
||||
display: block !important;
|
||||
|
||||
@include media('>desktop') {
|
||||
display: block !important;
|
||||
height: auto;
|
||||
max-height: unset;
|
||||
position: unset;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
ol.chapters {
|
||||
height: auto;
|
||||
max-height: unset;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.interstitial {
|
||||
|
||||
background-repeat: no-repeat !important;
|
||||
background-size: 36px 36px !important;
|
||||
background-position: 10px 10px !important;
|
||||
|
||||
&.note {
|
||||
background-image: url("../images/icon_task-list-pin.svg") !important;
|
||||
}
|
||||
|
||||
&.work-in-progress,
|
||||
&.todo {
|
||||
background-image: url("../images/icon_construction-sign.svg") !important;
|
||||
}
|
||||
|
||||
&.info {
|
||||
background-image: url("../images/icon_bulb-1.svg") !important;
|
||||
}
|
||||
|
||||
&.warning {
|
||||
background-image: url("../images/icon_hand-stop.svg") !important;
|
||||
}
|
||||
|
||||
&.question {
|
||||
background-image: url("../images/icon_question-bubble.svg") !important;
|
||||
}
|
||||
}
|
||||
|
||||
.code {
|
||||
background-color: #FAF9F8 !important;
|
||||
|
||||
pre, span {
|
||||
background-color: transparent !important;
|
||||
border: none;
|
||||
font-size: 9.5pt !important;
|
||||
}
|
||||
|
||||
button {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
hr {
|
||||
height: 1.5em;
|
||||
background: url("../images/hr_rails.svg") center no-repeat !important;
|
||||
}
|
||||
|
||||
code, pre {
|
||||
font-size: 9.5pt !important;
|
||||
}
|
||||
|
||||
} // body.guide
|
||||
}
|
||||
|
66
guides/assets/stylesrc/vendor/_boilerplate.scss
vendored
66
guides/assets/stylesrc/vendor/_boilerplate.scss
vendored
@ -178,69 +178,3 @@
|
||||
/* Style adjustments for high resolution devices */
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Print styles.
|
||||
Inlined to avoid the additional HTTP request:
|
||||
https://www.phpied.com/delay-loading-your-print-css/
|
||||
========================================================================== */
|
||||
|
||||
@media print {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
background: #fff !important;
|
||||
color: #000 !important;
|
||||
/* Black prints faster */
|
||||
box-shadow: none !important;
|
||||
text-shadow: none !important;
|
||||
}
|
||||
|
||||
a,
|
||||
a:visited {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a[href]::after {
|
||||
content: " (" attr(href) ")";
|
||||
}
|
||||
|
||||
abbr[title]::after {
|
||||
content: " (" attr(title) ")";
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't show links that are fragment identifiers,
|
||||
* or use the `javascript:` pseudo protocol
|
||||
*/
|
||||
a[href^="#"]::after,
|
||||
a[href^="javascript:"]::after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap !important;
|
||||
}
|
||||
|
||||
pre,
|
||||
blockquote {
|
||||
border: 1px solid #999;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
tr,
|
||||
img {
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
p,
|
||||
h2,
|
||||
h3 {
|
||||
orphans: 3;
|
||||
widows: 3;
|
||||
}
|
||||
|
||||
h2,
|
||||
h3 {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
}
|
@ -107,7 +107,7 @@ def select_only(guides)
|
||||
end
|
||||
|
||||
def process_scss
|
||||
system "bundle exec dartsass ./assets/stylesrc/style.scss:#{@output_dir}/stylesheets/style.css ./assets/stylesrc/highlight.scss:#{@output_dir}/stylesheets/highlight.css"
|
||||
system "bundle exec dartsass ./assets/stylesrc/style.scss:#{@output_dir}/stylesheets/style.css ./assets/stylesrc/highlight.scss:#{@output_dir}/stylesheets/highlight.css ./assets/stylesrc/print.scss:#{@output_dir}/stylesheets/print.css"
|
||||
end
|
||||
|
||||
def copy_assets
|
||||
|
Loading…
Reference in New Issue
Block a user