Skip to content

Commit 53a4baf

Browse files
chore: remove unnecessary canvas dependency (#5069)
1 parent 1ebff45 commit 53a4baf

File tree

5 files changed

+168
-2127
lines changed

5 files changed

+168
-2127
lines changed

docs/_data/supporters.js

-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
'use strict';
1919

20-
const {loadImage} = require('canvas');
2120
const {writeFile, mkdir, rm} = require('fs').promises;
2221
const {resolve} = require('path');
2322
const debug = require('debug')('mocha:docs:data:supporters');
@@ -115,13 +114,6 @@ const fetchImage = process.env.MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD
115114
);
116115
}
117116
debug('fetched %s', url);
118-
const canvasImage = await loadImage(imageBuf);
119-
debug('ok %s', url);
120-
supporter.dimensions = {
121-
width: canvasImage.width,
122-
height: canvasImage.height
123-
};
124-
// debug('dimensions %s %dw %dh', url, canvasImage.width, canvasImage.height);
125117
const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + '.png');
126118
await writeFile(filePath, imageBuf);
127119
debug('wrote %s', filePath);

docs/_includes/supporters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Use Mocha at Work? Ask your manager or marketing team if they'd help [support](h
88
{%- if supporter.website -%}
99
<a href="{{ supporter.website }}" target="_blank" rel="noopener">
1010
{%- endif -%}
11-
<div class="sponsor" title="{{ supporter.name }}" style="width: {{ supporter.dimensions.width }}px; background-image: url(/images/supporters/{{ supporter.id }}.png?sprite=sponsors)"></div>
11+
<div class="sponsor" title="{{ supporter.name }}" style="background-image: url(/images/supporters/{{ supporter.id }}.png?sprite=sponsors)"></div>
1212
{%- if supporter.website -%}
1313
</a>
1414
{%- endif -%}

docs/css/supporters.css

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
-sprite-location: url(/images/sprite-backers.png?pngquant);
1010
-sprite-image-format: png;
1111
-sprite-padding: 0 10;
12+
background-position: center;
13+
background-repeat: no-repeat;
14+
background-size: contain;
1215
width: 32px;
1316
height: 32px;
1417
}

0 commit comments

Comments
 (0)