History

Tweak print stylesheet

Thibaut Courouble committed 8 years ago

Commit 0bd82891 parent b681c806 files · +37 −68Browse files

Unified · Split

6 files
  1. assets/stylesheets/application-dark.css.scss +1 −0
  2. assets/stylesheets/application.css.scss +1 −4
  3. assets/stylesheets/global/_base.scss +3 −0
  4. assets/stylesheets/global/_classes.scss +0 −13
  5. assets/stylesheets/global/_mixins.scss +9 −0
  6. assets/stylesheets/global/_print.scss +23 −51
assets/stylesheets/application-dark.css.scss+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
12 */12 */
13 13
14@import 'global/variables-dark',14@import 'global/variables-dark',
15 'global/mixins',
15 'global/icons',16 'global/icons',
16 'global/classes',17 'global/classes',
17 'global/base';18 'global/base';
assets/stylesheets/application.css.scss+1−4
@@ -12,6 +12,7 @@ · 11 unmodified lines
12 */12 */
13 13
14@import 'global/variables',14@import 'global/variables',
15 'global/mixins',
15 'global/icons',16 'global/icons',
16 'global/classes',17 'global/classes',
17 'global/base';18 'global/base';
@@ -98,7 +99,3 @@ · 80 unmodified lines
98 'pages/webpack',99 'pages/webpack',
99 'pages/yard',100 'pages/yard',
100 'pages/yii';101 'pages/yii';
101
102html { // specificity hack
103 @import 'global/print';
104}
assets/stylesheets/global/_base.scss+3−0
@@ -4,6 +4,9 @@ html { · 3 unmodified lines
4 background: $documentBackground;4 background: $documentBackground;
5 5
6 @media #{$mediumScreen} { font-size: 93.75%; }6 @media #{$mediumScreen} { font-size: 93.75%; }
7
8 @include print { background: none; }
9 @import 'global/print';
7}10}
8 11
9body {12body {
assets/stylesheets/global/_classes.scss+0−13
@@ -2,19 +2,6 @@ · 1 unmodified line
2// Utilities2// Utilities
3//3//
4 4
5/* Usage:
6 *
7 * @include print {
8 * // print styles here
9 * }
10 *
11 */
12@mixin print {
13 @media print {
14 @content;
15 }
16}
17
18%border-box {5%border-box {
19 -moz-box-sizing: border-box;6 -moz-box-sizing: border-box;
20 box-sizing: border-box;7 box-sizing: border-box;
assets/stylesheets/global/_mixins.scss+9−0
@@ -0,0 +1,9 @@
1//
2// Mixins
3//
4
5@mixin print {
6 @media print {
7 @content;
8 }
9}
assets/stylesheets/global/_print.scss+23−51
@@ -1,79 +1,51 @@
1// Style overrides for printing
2
3@include print {1@include print {
4 2 ._header, ._sidebar, ._path, ._notif, ._toc, ._pre-clip, ._notice, ._links {
5 ._header, ._sidebar, ._path, ._notif, ._toc, ._pre-clip, ._notice {
6 display: none !important;3 display: none !important;
7 }4 }
8 5
9 // make the docs fill the page and scroll the <body> instead of ._container6 body, ._app, ._container, ._content {
10 body {
11 height: initial;
12 &::after {
13 content: '';
14 clear: both;
15 }
16 }
17 ._app {
18 height: initial;
19 }
20 ._container {
21 margin: 0;7 margin: 0;
22 padding: 0;8 padding: 0;
23 height: initial;9 height: initial;
10 background: none;
24 11
25 ._content {12 &:after {
26 margin: 0;13 content: '';
14 clear: both;
27 }15 }
28 }16 }
29 17
30 // Hide the scrollbars
31 ::-webkit-scrollbar {18 ::-webkit-scrollbar {
32 display: none;19 display: none;
33 }20 }
34 21
35 // empty the boxes.22 %external-link:after {
36 %box,23 display: none;
37 %heading-box {
38 background: transparent;
39 }
40 %heading-box {
41 border-radius: 0;
42 border: {
43 top: none;
44 left: none;
45 right: none;
46 }
47 }24 }
48 25
26 ._attribution-p {
27 background: none;
28 border: 2px solid $boxBorder;
29 }
49 30
50 // Underline links, put the destination after the link text31 ._attribution:last-child:after {
51 %external-link {32 content: 'Exported from DevDocs — https://devdocs.io';
52 text-decoration: underline;33 display: block;
53 &::after {34 margin-top: 1rem;
54 content: ' (' attr(href) ')';35 font-weight: $bolderFontWeight;
55 background-image: none;
56 display: inline;
57 margin: 0;
58 }
59 }36 }
60 37
61 // Link back to DevDocs38 ._attribution {
62 ._attribution-p {39 page-break-inside: avoid;
63 background: transparent;40 }
64 border: 2px solid $labelBackground;
65 41
66 &:after {42 h1, h2, h3, h4, h5, h6 {
67 content: 'Exported from DevDocs (https://devdocs.io)';43 page-break-inside: avoid;
68 font-style: italic;44 page-break-after: avoid;
69 }
70 }45 }
71 46
72 // Fix page breaks
73 pre {47 pre {
74 page-break-before: avoid;48 page-break-before: avoid;
75 }
76 pre {
77 orphans: 5;49 orphans: 5;
78 widows: 5;50 widows: 5;
79 }51 }