Skip to content

Commit 8be4ad1

Browse files
authored
Merge branch 'master' into bugfix-typescript-errors-not-outputted
2 parents b70a40c + 3345eff commit 8be4ad1

File tree

5 files changed

+2127
-168
lines changed

5 files changed

+2127
-168
lines changed

docs/_data/supporters.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
'use strict';
1919

20+
const {loadImage} = require('canvas');
2021
const {writeFile, mkdir, rm} = require('fs').promises;
2122
const {resolve} = require('path');
2223
const debug = require('debug')('mocha:docs:data:supporters');
@@ -114,6 +115,13 @@ const fetchImage = process.env.MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD
114115
);
115116
}
116117
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);
117125
const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + '.png');
118126
await writeFile(filePath, imageBuf);
119127
debug('wrote %s', filePath);

docs/_includes/supporters.md

Lines changed: 1 addition & 1 deletion
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="background-image: url(/images/supporters/{{ supporter.id }}.png?sprite=sponsors)"></div>
11+
<div class="sponsor" title="{{ supporter.name }}" style="width: {{ supporter.dimensions.width }}px; background-image: url(/images/supporters/{{ supporter.id }}.png?sprite=sponsors)"></div>
1212
{%- if supporter.website -%}
1313
</a>
1414
{%- endif -%}

docs/css/supporters.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
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;
1512
width: 32px;
1613
height: 32px;
1714
}

0 commit comments

Comments
 (0)