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

Some fixes, some mods #148

Merged
merged 7 commits into from
Aug 22, 2016
Merged

Some fixes, some mods #148

merged 7 commits into from
Aug 22, 2016

Conversation

dangreen
Copy link
Contributor

@dangreen dangreen commented Aug 21, 2016

Fixes

1. source parameter as argument

In documentation we can see:

or array of { size: filepath }

but according to the code it should be map, not array:

{ [size]: [filepath] }

Now source can be array of paths. And better to use sizeOf function instead of:

sourceset.push({
    size: { width: size, height: size, type: 'png' },
    file: buffer
});

2. Firefox icon

Overlay should be behind main icon.
Icon from RFG:
rfg
Before (without offset):
before
After (with offset):
after

3. HTML tags from RFG

Before:

html: [ '<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">\n<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">\n<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">\n<link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">\n<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">\n<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">\n<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">\n<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">\n<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">\n<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">\n<link rel="icon" type="image/png" href="/favicon-230x230.png" sizes="230x230">\n<link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192">\n<link rel="icon" type="image/png" href="/coast-228x228.png" sizes="228x228">\n<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">\n<link rel="manifest" href="/manifest.json">\n<link rel="yandex-tableau-widget" href="/yandex-browser-manifest.json">\n<meta name="theme-color" content="#0030d9">' ] }

After:

html: 
   [ '<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">',
     '<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">',
     '<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">',
     '<link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">',
     '<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">',
     '<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">',
     '<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">',
     '<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">',
     '<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">',
     '<meta name="apple-mobile-web-app-capable" content="yes">',
     '<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">',
     '<meta name="apple-mobile-web-app-title">',
     '<link rel="icon" type="image/png" sizes="228x228" href="/coast-228x228.png">',
     '<link rel="yandex-tableau-widget" href="/yandex-browser-manifest.json">',
     '<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">',
     '<link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png">',
     '<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">',
     '<link rel="shortcut icon" href="/favicon.ico">',
     '<link rel="manifest" href="/manifest.json">',
     '<meta name="mobile-web-app-capable" content="yes">',
     '<meta name="theme-color" content="#0030d9">',
     '<meta name="application-name">' ] }

4. Offset fix

  • I also fixed some troubles with offset in firefox icon.
  • Now offset size should be calculated right.

5. Convert color to HEX for RFG

RFG throws error if color is not in HEX format. Now color converts to HEX.

Mods

1. Partial offline SVG support

Now if sourceset contains SVG source, new image will be generated instead of resizing PNG source.
Before (from 512x512 PNG):
before
After (from SVG):
after

2. Offsets with RFG

Now offset parameters will be applied to the RFG request.

3. Platform options

Certain parameters can be applied for certain platforms. This rules are described in config/platform-options.json. For now it has only one parameter, but in near future I can add some parameters from RFG, which will be available only with online: true.

4. Prefer online option

If preferOnline option is setted to true and online generation was failed, then icons will be generated offline.

@haydenbleasel
Copy link
Contributor

Nice work!

@haydenbleasel haydenbleasel merged commit 0f063be into itgalaxy:master Aug 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants