History

Add a print stylesheet removing the DevDocs UI

Jed Fox committed 9 years ago

Commit b681c801 parent c91bf6f4 files · +106 −0Browse files

Unified · Split

4 files
  1. assets/stylesheets/application.css.scss +4 −0
  2. assets/stylesheets/global/_classes.scss +13 −0
  3. assets/stylesheets/global/_print.scss +85 −0
  4. assets/stylesheets/pages/_rdoc.scss +4 −0
assets/stylesheets/application.css.scss+4−0
@@ -98,3 +98,7 @@ · 97 unmodified lines
9898 'pages/webpack',
9999 'pages/yard',
100100 'pages/yii';
101+
102+html { // specificity hack
103+ @import 'global/print';
104+}
assets/stylesheets/global/_classes.scss+13−0
@@ -2,6 +2,19 @@ · 1 unmodified line
22 // Utilities
33 //
44
5+/* Usage:
6+ *
7+ * @include print {
8+ * // print styles here
9+ * }
10+ *
11+ */
12+@mixin print {
13+ @media print {
14+ @content;
15+ }
16+}
17+
518 %border-box {
619 -moz-box-sizing: border-box;
720 box-sizing: border-box;
assets/stylesheets/global/_print.scss+85−0
@@ -0,0 +1,85 @@
1+// Style overrides for printing
2+
3+@include print {
4+
5+ ._header, ._sidebar, ._path, ._notif, ._toc, ._pre-clip, ._notice {
6+ display: none !important;
7+ }
8+
9+ // make the docs fill the page and scroll the <body> instead of ._container
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;
22+ padding: 0;
23+ height: initial;
24+
25+ ._content {
26+ margin: 0;
27+ }
28+ }
29+
30+ // Hide the scrollbars
31+ ::-webkit-scrollbar {
32+ display: none;
33+ }
34+
35+ // empty the boxes.
36+ %box,
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+ }
48+
49+
50+ // Underline links, put the destination after the link text
51+ %external-link {
52+ text-decoration: underline;
53+ &::after {
54+ content: ' (' attr(href) ')';
55+ background-image: none;
56+ display: inline;
57+ margin: 0;
58+ }
59+ }
60+
61+ // Link back to DevDocs
62+ ._attribution-p {
63+ background: transparent;
64+ border: 2px solid $labelBackground;
65+
66+ &:after {
67+ content: 'Exported from DevDocs (https://devdocs.io)';
68+ font-style: italic;
69+ }
70+ }
71+
72+ // Fix page breaks
73+ pre {
74+ page-break-before: avoid;
75+ }
76+ pre {
77+ orphans: 5;
78+ widows: 5;
79+ }
80+
81+ p {
82+ orphans: 2;
83+ widows: 2;
84+ }
85+}
assets/stylesheets/pages/_rdoc.scss+4−0
@@ -27,6 +27,10 @@ · 26 unmodified lines
2727 @extend %user-select-none;
2828
2929 &:hover { text-decoration: underline; }
30+
31+ @include print {
32+ display: none;
33+ }
3034 }
3135
3236 .method-description { position: relative; }