-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
executable file
·130 lines (123 loc) · 4.4 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
require "rake"
require "json"
BLOCKERS = [{
# Block web fonts on every page except locally (for web development) and on JustFont, which sells
# web fonts.
"url-filter" => ".",
"resource-type" => ["font"],
"unless-domain" => ["justfont.com", "localhost"]
}, {
# Block everything loaded from Google's Fonts service (including CSS).
"url-filter" => "/fonts\\.googleapis\\.com/"
}, {
# Block Adobe TypeKit.
"url-filter" => "/use\\.typekit\\.com/",
"resource-type" => ["font", "raw", "style-sheet"],
"unless-domain" => ["typekit.com"]
}]
EXCEPTIONS = [
# Generic exception for icon fonts.
/\..*\/.*icon/,
# Generic exception for Font Awesome.
/\..*\/.*awesome/,
# Generic exception for SS Pika.
/\..*\/.*ss-pika/,
# Generic exception for files generated by IcoMoon.
/\..*\/.*icomoon/,
# Exception for icon font on imgur.com.
# https://github.com/lurado/SansFonts/issues/7
/fonts\/imgur\./,
# Exception for icon font on hipchat.com and hosted HipChat instances.
# https://github.com/lurado/SansFonts/issues/4
/fonts\/hipchat\./,
# Exception for icon font on telekom.de.
# https://github.com/lurado/SansFonts/issues/9
/-logo\./,
# Generic exception for Fontastic.
/fontastic/,
# Generic exception for PictoFont.
/pictofont\./,
# Generic exception for Fontello.
# https://github.com/lurado/SansFonts/issues/21
/fontello/,
# Generic exception for SS Standard.
# https://github.com/lurado/SansFonts/issues/26
/ss-standard\./,
# Generic exception for the Elegant Themes icon font.
# https://github.com/lurado/SansFonts/issues/24
/ETmodules_/,
# Generic exception for the Projekktor video player.
# https://github.com/lurado/SansFonts/issues/13
/projekktor\./,
# Generic exception for the mol video player.
# https://github.com/lurado/SansFonts/issues/27
/\/mol-video\./,
# Exception for icon font on atlasobscura.com.
# https://github.com/lurado/SansFonts/issues/30
/atlasobscura\./,
# Exception for icon fonts on Jimdo-hosted websites.
# https://github.com/lurado/SansFonts/issues/32
/assets\.jimstatic\.com/,
# Exception for icon fonts on the Matador network.
# https://github.com/lurado/SansFonts/issues/20
/\/fonts\/matador-network\./,
# Exception for icon fonts on bauhaus.de.
# https://github.com/lurado/SansFonts/issues/29
/\/fonts\/bauhaus\./,
# Exception for icon fonts on imgur.com
# https://github.com/lurado/SansFonts/issues/28
/\/fonts\/imgur-/,
# Exception for icon fonts on airbnb.com.
# https://github.com/lurado/SansFonts/issues/23
/\/fonts\/airglyphs-/,
# Exception for icon fonts on bloomberg.com.
# https://github.com/lurado/SansFonts/issues/19
/\/fonts\/Bloomberg/,
# Exception for icon fonts on blendle.de.
# https://github.com/lurado/SansFonts/issues/18
/\/fonts\/blendle\/blendle\./,
# Exception for icon fonts on heroku.com.
# https://github.com/lurado/SansFonts/issues/17
/\/fonts\/heroku-dc\./,
# Exception for icon fonts on zapier.com.
# https://github.com/lurado/SansFonts/issues/16
/\/fonts\/zapier\./,
# Exception for icon fonts on gsmarena.com.
# https://github.com/lurado/SansFonts/issues/10
/\/fonts\/gsmarena\./,
# Exception for icon fonts on hongkiat.com.
# https://github.com/lurado/SansFonts/issues/44
/\/fonts\/hongkiatcom\./,
# Exception for icon fonts on pr0gramm.com.
# https://github.com/lurado/SansFonts/issues/40
/\/fonts\/pict0gramm\./,
# Exception for icon fonts on opodo.com.
# https://github.com/lurado/SansFonts/issues/39
/odistatic\.net.*fonts\/opodo.*/,
# Exception for icon fonts in the AWS console.
/cloudfront\.net\/aws-console/,
# Exception for icon fonts on *.dev, for local development.
# https://github.com/lurado/SansFonts/issues/35
/\.dev\//,
# Exception for Apple's web fonts, because without them, all text on *.apple.com will be rendered
# using their icon font.
# https://github.com/lurado/SansFonts/issues/49
/apple\.com\/wss\/fonts\//,
]
file "blockerList.json" => "Rakefile" do
blockers = BLOCKERS.map do |blocker|
{
"action" => { "type" => "block" },
"trigger" => blocker
}
end
exceptions = EXCEPTIONS.map do |exception|
{
"action" => { "type" => "ignore-previous-rules" },
"trigger" => { "url-filter": exception.inspect[1..-2] }
}
end
json = JSON.pretty_generate(blockers + exceptions, :indent => " ")
File.write("blockerList.json", json)
end
task :default => "blockerList.json"