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

Logos cleanup and AppVeyor #812

Merged
merged 3 commits into from
Apr 28, 2017
Merged

Logos cleanup and AppVeyor #812

merged 3 commits into from
Apr 28, 2017

Conversation

techtonik
Copy link
Contributor

@techtonik techtonik commented Oct 19, 2016

This adds AppVeyor logo to its badge. Fixes #507.

@techtonik techtonik changed the title Move load-logos.js into lib/ Logos cleanup and AppVeyor Oct 19, 2016
techtonik referenced this pull request in techtonik/shields Jan 23, 2017
@paulmelnikow paulmelnikow added frontend The Docusaurus app serving the docs site service-badge New or updated service badge and removed frontend The Docusaurus app serving the docs site labels Apr 13, 2017
@techtonik
Copy link
Contributor Author

Rebased and squashed.

logoFiles.forEach(function(filename) {
if (filename[0] === '.') { return; }
// filename is eg, github.svg
var svg = fs.readFileSync(
path.join(__dirname, '..', 'logo', filename)).toString();
var svg = fs.readFileSync(logoDir + '/' + filename).toString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use a call to path.join here? It works better across platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my Windows it works okay, so I don't see why it is needed here. It probably matters if you have to call some external Windows program and pass the path there, which is not the case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the node internal functions handle either okay.

Copy link
Member

@espadrine espadrine Apr 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows internally supports forward slashes. The main purpose of path.join() in practice is path normalization, eg. path.join('foo/', '..', 'bar') === 'bar'.

<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
<path fill="#09A9ED" d="M20 0c11 0 20 9 20 20s-9 20-20 20S0 31 0 20 9 0 20 0zm4.9 23.9c2.2-2.8 1.9-6.8-.9-8.9-2.7-2.1-6.7-1.6-9 1.2-2.2 2.8-1.9 6.8.9 8.9 2.8 2.1 6.8 1.6 9-1.2zm-10.7 13c1.2.5 3.8 1 5.1 1L28 25.3c2.8-4.2 2.1-9.9-1.8-13-3.5-2.8-8.4-2.7-11.9 0L2.2 21.6c.3 3.2 1.2 4.8 1.2 4.9l6.9-7.5c-.5 3.3.7 6.7 3.5 8.8 2.4 1.9 5.3 2.4 8.1 1.8l-7.7 7.3z"/>
<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'>
<path fill='#ddd' d='M20 0c11 0 20 9 20 20s-9 20-20 20S0 31 0 20 9 0 20 0zm4.9 23.9c2.2-2.8 1.9-6.8-.9-8.9-2.7-2.1-6.7-1.6-9 1.2-2.2 2.8-1.9 6.8.9 8.9 2.8 2.1 6.8 1.6 9-1.2zm-10.7 13c1.2.5 3.8 1 5.1 1L28 25.3c2.8-4.2 2.1-9.9-1.8-13-3.5-2.8-8.4-2.7-11.9 0L2.2 21.6c.3 3.2 1.2 4.8 1.2 4.9l6.9-7.5c-.5 3.3.7 6.7 3.5 8.8 2.4 1.9 5.3 2.4 8.1 1.8l-7.7 7.3z'/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the quote style from " to '?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Unfortunately changing the quote style makes no size reduction Shields, since the logos are base64-encoded, not URL-encoded.

Let's do this in a concerted way. Could you leave/use double quotes for now, and open an issue or a separate PR to drop base64 encoding and change the quote style?

Possibly we could change the quote style on the fly, as that post suggests, though modifying the checked-in logos could makes sense too. I'd like to benchmark the response size changes, to make sure the optimization is having the desired effect, and also do some browser testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can commit quotes for other logos in a separate commit for testing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you reset them here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to avoid spending more time on this. There are design fixes inside. I wish I submitted the logo with single quotes from the start,

<svg id='Layer_1' xmlns='http://www.w3.org/2000/svg' viewBox='-391.8 393.6 14 15.4'><style>.st0{fill:none}.st1{fill:#FFF}</style><path class='st0' d='M-1295 274H1v1296h-1296z'/><path class='st1' d='M-377.8 400.7c-.1-.6-.2-1.2-.4-1.8-.5-1.6-1.6-3.3-2.8-4.5-.1 0-.3-.2-.4-.1-.2.1.2.9.2 1.1.3.9.5 1.8.3 2.8-.3 1.2-1.2 2.1-2.5 2.2-.7.1-1.4 0-2.1.1-1 .1-2.1.5-2.8 1.3-.1.1-.1.2-.2.3-.3 0-.5-.1-.6-.1h-.1c-.8-.4-1.3-1.4-1.7-2.2-.2-.4-.3-.7-.4-1.1 0-.2 0-.4-.1-.5v-.4c-.1-.2-.3 0-.3.2 0 .3-.1.6-.1.8 0 .5.2 1 .3 1.4.3.7.6 1.3 1.1 1.8l.6.6c.2.2.4.3.6.5.2.3.2.6.2.9 0 .8-.1 1.5.2 2.3.2.7.4 1.4.8 1.9.2.3.5.6.7.8.2.1.5.2.3-.4-.4-1.2-.5-2.4.2-3.5.6-.9 1.6-1.7 2.8-1.6 1.7.2 2.9 1.8 2.8 3.5 0 .5 0 .9-.2 1.3-.1.2-.1.4-.1.6.1.3.4.2.6 0 .4-.6.9-1.1 1.2-1.7 1.5-2.1 2.2-4.3 1.9-6.5z'/><path class='st1' d='M-387.5 396c0 .1.1.2.1.3v.1c.1.3.4.4.6.6.1.1.4.2.6.2.2.1.7 0 .9 0 .5 0 1-.2 1.4 0-2.3 2.7-.1 3.3 1.6 2 1.9-1.5.1-5 .1-5s0-.3-.8-.4c-.1 0-.1-.1-.2-.1-.6-.3-1.3.2-1.8.7-.2.1-.3.3-.5.4-.2.2-.5.3-.7.4-.3.1-.6.3-.9.3h-.2c-.1 0-.2 0-.2.1 0 0-.1.1-.1.2-.1 0 0 .1.1.2z'/></svg>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you reset these files? They seem to be unrelated to this change.

@paulmelnikow
Copy link
Member

Hi, thanks for this and for rebasing. Would like to get this merged.

Just a testing code:

    var loadLogos = require('./lib/load-logos.js');
    var logos = loadLogos();

    console.log(logos);
@techtonik
Copy link
Contributor Author

@paulmelnikow left logo size optimization out of commit for now.

@paulmelnikow paulmelnikow merged commit 6c34191 into badges:master Apr 28, 2017
@paulmelnikow paulmelnikow added this to the Next Deploy milestone Apr 28, 2017
@techtonik
Copy link
Contributor Author

techtonik commented Apr 28, 2017

@paulmelnikow thanks for taking care of this.

@techtonik techtonik deleted the logos branch April 28, 2017 09:08
@billziss-gh
Copy link

billziss-gh commented May 1, 2017

For what it's worth I personally dislike this change.

One of the reasons that I use shields.io badges it that I can customize them. Having a logo added to what was a "custom" badge is a breaking change from my point of view.

I use Travis CI for OSX/Linux builds and AppVeyor for Windows builds. To differentiate between the builds I have custom shields.io badges that read "osx/linux " for Travis CI and "windows " for appveyor.

From cgofuse:

Please consider not adding the logo on "custom" badges (i.e. ones with labels, etc). Alternatively add logo images for all services (e.g. Travis CI).

@techtonik
Copy link
Contributor Author

@billziss-gh if you can find optimized logo for Travis CI in SVG along with its license, that can help it.

@billziss-gh
Copy link

@techtonik thanks for the quick answer and opening up a new issue on this.

@paulmelnikow
Copy link
Member

Hi @billziss-gh, thanks for the feedback + for opening an issue @techtonik.

I like supporting these logos on flat badges. We could consider making them opt in. The principle should be to do what's right for badge consumers as a whole, in the long run.

I posted a comment in #983. Let's continue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants