Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unnecessary canvas dependency #5069

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions docs/_data/supporters.js
Expand Up @@ -17,7 +17,6 @@

'use strict';

const {loadImage} = require('canvas');
const {writeFile, mkdir, rm} = require('fs').promises;
const {resolve} = require('path');
const debug = require('debug')('mocha:docs:data:supporters');
Expand Down Expand Up @@ -115,13 +114,6 @@ const fetchImage = process.env.MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD
);
}
debug('fetched %s', url);
const canvasImage = await loadImage(imageBuf);
debug('ok %s', url);
supporter.dimensions = {
width: canvasImage.width,
height: canvasImage.height
};
// debug('dimensions %s %dw %dh', url, canvasImage.width, canvasImage.height);
const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + '.png');
await writeFile(filePath, imageBuf);
debug('wrote %s', filePath);
Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/supporters.md
Expand Up @@ -8,7 +8,7 @@ Use Mocha at Work? Ask your manager or marketing team if they'd help [support](h
{%- if supporter.website -%}
<a href="{{ supporter.website }}" target="_blank" rel="noopener">
{%- endif -%}
<div class="sponsor" title="{{ supporter.name }}" style="width: {{ supporter.dimensions.width }}px; background-image: url(/images/supporters/{{ supporter.id }}.png?sprite=sponsors)"></div>
<div class="sponsor" title="{{ supporter.name }}" style="background-image: url(/images/supporters/{{ supporter.id }}.png?sprite=sponsors)"></div>
{%- if supporter.website -%}
</a>
{%- endif -%}
Expand Down
3 changes: 3 additions & 0 deletions docs/css/supporters.css
Expand Up @@ -9,6 +9,9 @@
-sprite-location: url(/images/sprite-backers.png?pngquant);
-sprite-image-format: png;
-sprite-padding: 0 10;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
width: 32px;
height: 32px;
}