Skip to content

Commit 21370bc

Browse files
committed
Delete some unused images
Add a sanity test to ensure all images are used
1 parent 9b19fdf commit 21370bc

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

sites/en/frontend/img/github.png

-66.2 KB
Binary file not shown.
-195 KB
Binary file not shown.
-46.3 KB
Binary file not shown.
-58.9 KB
Binary file not shown.

spec/site_syntax_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
require "rack/test"
77

8+
here = File.expand_path File.dirname(__FILE__)
9+
810
describe "Syntax check all sites" do
911
include Rack::Test::Methods
1012

@@ -16,6 +18,15 @@ def app
1618
describe "in locale '#{locale}'" do
1719
Site.all(locale).each do |site|
1820
describe "#{site.name} pages..." do
21+
it 'uses all images in the /img folder' do
22+
site_folder = File.expand_path(File.join(here, '..', 'sites', locale, site.name))
23+
unused_images = Dir[File.join(site_folder, 'img', '*')].select do |image_path|
24+
image_file = File.basename(image_path)
25+
system("grep -R #{image_file} #{site_folder} > /dev/null") ? nil : image_file
26+
end
27+
expect(unused_images).to eq([])
28+
end
29+
1930
site.docs.each do |doc|
2031
it "renders #{doc.filename}" do
2132
path = URI.escape "/#{site.name}/#{doc.name}"

0 commit comments

Comments
 (0)