Skip to content

Commit d700ba1

Browse files
committed
Optimize packaged gem & use nice system fonts
Reduces the gem size by about an order of magitude by ignoring various unneeded files. Includes removal of the font files and unnecessary image files.
1 parent de867ed commit d700ba1

25 files changed

+26
-40
lines changed

graphql-docs.gemspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ Gem::Specification.new do |spec|
3030
}
3131

3232
spec.files = `git ls-files -z`.split("\x0").reject do |f|
33-
f.match(%r{^(test|spec|features)/})
33+
f.match(%r{^(test|spec|features|\.github)/}) ||
34+
f.match(%r{^(Gemfile|Rakefile|CODE_OF_CONDUCT\.md|CONTRIBUTING\.md|\.gitignore|\.rubocop\.yml|\.standard\.yml|config\.ru)$}) ||
35+
f.match(%r{/webfonts/}) # Exclude webfonts directory - using system fonts
3436
end
3537
spec.bindir = "exe"
3638
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }

lib/graphql-docs/layouts/assets/_sass/_content.scss

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
font-style: italic;
88
}
99
strong {
10-
font-family: 'ProximaNova-Bold';
10+
font-weight: 700;
1111
}
1212
h1 {
1313
margin: 15px 0;
@@ -188,7 +188,7 @@
188188
.highlight.html {
189189
.code {
190190
&:after {
191-
font-family: 'ProximaNova-Semibold';
191+
font-weight: 600;
192192
position: absolute;
193193
top: 0;
194194
right: 0;
@@ -206,7 +206,7 @@
206206
.highlight.js {
207207
.code {
208208
&:after {
209-
font-family: 'ProximaNova-Semibold';
209+
font-weight: 600;
210210
position: absolute;
211211
top: 0;
212212
right: 0;
@@ -224,7 +224,7 @@
224224
.highlight.bash {
225225
.code {
226226
&:after {
227-
font-family: 'ProximaNova-Semibold';
227+
font-weight: 600;
228228
position: absolute;
229229
top: 0;
230230
right: 0;
@@ -242,7 +242,7 @@
242242
.highlight.css {
243243
.code {
244244
&:after {
245-
font-family: 'ProximaNova-Semibold';
245+
font-weight: 600;
246246
position: absolute;
247247
top: 0;
248248
right: 0;
@@ -260,7 +260,7 @@
260260
.highlight.jsx {
261261
.code {
262262
&:after {
263-
font-family: 'ProximaNova-Semibold';
263+
font-weight: 600;
264264
position: absolute;
265265
top: 0;
266266
right: 0;
@@ -460,7 +460,7 @@
460460
}
461461
}
462462
th {
463-
font-family: 'ProximaNova-Semibold';
463+
font-weight: 600;
464464
padding: 12px 13px;
465465
border: 1px solid var(--border-color);
466466
vertical-align: middle;
@@ -481,15 +481,15 @@
481481
border-bottom: 1px solid var(--border-color);
482482
padding-bottom: 25px;
483483
a {
484-
font-family: 'ProximaNova-Semibold';
484+
font-weight: 600;
485485
margin: 0 5px;
486486
}
487487
}
488488
.edit-link {
489489
text-align: center;
490490
a {
491491
color: #aaa;
492-
font-family: 'ProximaNova-Semibold';
492+
font-weight: 600;
493493
&:before {
494494
content: '';
495495
display: inline-block;
Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
1-
@import "//hello.myfonts.net/count/2c4b9d";
2-
@font-face {
3-
font-family: 'ProximaNova-Light';
4-
src: url("webfonts/2C4B9D_B_0.eot");
5-
src: url("webfonts/2C4B9D_B_0.eot?#iefix") format('embedded-opentype'), url("webfonts/2C4B9D_B_0.woff2") format('woff2'), url("webfonts/2C4B9D_B_0.woff") format('woff'), url("webfonts/2C4B9D_B_0.ttf") format('truetype');
6-
}
7-
@font-face {
8-
font-family: 'ProximaNova-Semibold';
9-
src: url("webfonts/2C4B9D_C_0.eot");
10-
src: url("webfonts/2C4B9D_C_0.eot?#iefix") format('embedded-opentype'), url("webfonts/2C4B9D_C_0.woff2") format('woff2'), url("webfonts/2C4B9D_C_0.woff") format('woff'), url("webfonts/2C4B9D_C_0.ttf") format('truetype');
11-
}
12-
@font-face {
13-
font-family: 'ProximaNova-Regular';
14-
src: url("webfonts/2C4B9D_D_0.eot");
15-
src: url("webfonts/2C4B9D_D_0.eot?#iefix") format('embedded-opentype'), url("webfonts/2C4B9D_D_0.woff2") format('woff2'), url("webfonts/2C4B9D_D_0.woff") format('woff'), url("webfonts/2C4B9D_D_0.ttf") format('truetype');
16-
}
17-
@font-face {
18-
font-family: 'ProximaNova-Bold';
19-
src: url("webfonts/2C4B9D_E_0.eot");
20-
src: url("webfonts/2C4B9D_E_0.eot?#iefix") format('embedded-opentype'), url("webfonts/2C4B9D_E_0.woff2") format('woff2'), url("webfonts/2C4B9D_E_0.woff") format('woff'), url("webfonts/2C4B9D_E_0.ttf") format('truetype');
21-
}
1+
// Modern system font stack - no webfonts needed!
2+
$font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
3+
$font-stack-light: $font-stack;
4+
$font-stack-regular: $font-stack;
5+
$font-stack-semibold: $font-stack;
6+
$font-stack-bold: $font-stack;

lib/graphql-docs/layouts/assets/_sass/_search.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
background-color: var(--bg-primary);
2121
color: var(--text-primary);
2222
outline: none;
23-
font-family: 'ProximaNova-Regular';
23+
font-family: inherit;
2424
font-size: 14px;
2525
padding: 7px 12px 6px 32px;
2626
border-radius: 20px;
@@ -42,7 +42,7 @@
4242
background-color: var(--bg-primary);
4343
color: var(--text-primary);
4444
outline: none;
45-
font-family: 'ProximaNova-Regular';
45+
font-family: inherit;
4646
font-size: 14px;
4747
padding: 7px 12px 6px 32px;
4848
border-radius: 20px;

lib/graphql-docs/layouts/assets/_sass/_sidebar.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
overflow-y: scroll;
1212
-webkit-overflow-scrolling: touch;
1313
-ms-overflow-style: none;
14-
font-family: 'ProximaNova-Semibold';
14+
font-weight: 600;
1515
border-right: 1px solid var(--border-color);
1616
font-size: 16px;
1717
line-height: 1.1em;
@@ -48,7 +48,7 @@
4848
}
4949
}
5050
.sub-menu {
51-
font-family: 'ProximaNova-Regular';
51+
font-weight: 400;
5252
padding-left: 20px;
5353
margin: 0.6em 0;
5454
font-size: 14px;
@@ -95,7 +95,7 @@
9595
color: var(--text-primary);
9696
border: none;
9797
font-size: 14px;
98-
font-family: 'ProximaNova-Semibold';
98+
font-weight: 600;
9999
}
100100

101101
input:focus {

lib/graphql-docs/layouts/assets/css/screen.scss

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
}
4040

4141
body {
42-
font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
42+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
4343
-webkit-font-smoothing: antialiased;
4444
-moz-osx-font-smoothing: grayscale;
4545
font-size: 16px;
@@ -53,8 +53,7 @@ h3,
5353
h4,
5454
h5,
5555
h6 {
56-
font-family: 'ProximaNova-Semibold';
57-
font-weight: 200;
56+
font-weight: 600;
5857
}
5958
em {
6059
font-style: italic;
@@ -72,7 +71,7 @@ em {
7271
left: 0;
7372
width: 100%;
7473
height: 100px;
75-
font-family: 'ProximaNova-Semibold';
74+
font-weight: 600;
7675
}
7776

7877
@include meta.load-css('../_sass/_header');
-168 KB
Binary file not shown.
-103 KB
Binary file not shown.
-133 KB
Binary file not shown.
-57.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)