Last active
March 19, 2018 16:47
-
-
Save LoyEgor/4110b09a4b834e2856e53d0edc33e8fb to your computer and use it in GitHub Desktop.
Real Favicon Generator Settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm i gulp-real-favicon | |
var realFavicon = require('gulp-real-favicon'); | |
var fs = require('fs'); | |
// File where the favicon markups are stored | |
var FAVICON_DATA_FILE = 'faviconData.json'; | |
// Generate the icons. | |
gulp.task('generate-favicon', function(done) { | |
realFavicon.generateFavicon({ | |
masterPicture: 'app/assets/favicons/basic.png', //optimal size 300px | |
dest: 'app/assets/favicons', | |
iconsPath: 'assets/favicons', | |
design: { | |
ios: { | |
pictureAspect: 'backgroundAndMargin', //Add a solid, plain background to fill the transparent regions. | |
backgroundColor: '#ffffff', | |
margin: '14%', | |
assets: { | |
ios6AndPriorIcons: false, | |
ios7AndLaterIcons: false, | |
precomposedIcons: false, | |
declareOnlyDefaultIcon: true | |
} | |
}, | |
desktopBrowser: {}, | |
windows: { | |
masterPicture: 'app/assets/favicons/basic_invert.png', //remove if basic.png is fine | |
pictureAspect: 'whiteSilhouette', //Use a white silhouette version of the favicon | |
backgroundColor: '#EE1C2A', | |
onConflict: 'override', | |
assets: { | |
windows80Ie10Tile: false, | |
windows10Ie11EdgeTiles: { | |
small: false, | |
medium: true, | |
big: false, | |
rectangle: false | |
} | |
} | |
}, | |
androidChrome: { | |
pictureAspect: 'noChange', | |
themeColor: '#EE1C2A', | |
manifest: { | |
display: 'standalone', | |
orientation: 'notSet', | |
onConflict: 'override', | |
declared: true | |
}, | |
assets: { | |
legacyIcon: false, | |
lowResolutionIcons: false | |
} | |
}, | |
safariPinnedTab: { | |
masterPicture: 'app/assets/favicons/basic_invert.png', //remove if basic.png is fine | |
pictureAspect: 'silhouette', //if image has transparent background | |
// pictureAspect: 'blackAndWhite', //if image has white background | |
// threshold: 99, //if image has white background | |
themeColor: '#EE1C2A' | |
} | |
}, | |
settings: { | |
scalingAlgorithm: 'Mitchell', | |
errorOnImageTooSmall: false | |
}, | |
markupFile: FAVICON_DATA_FILE | |
}, function() { | |
done(); | |
}); | |
}); | |
// Inject the favicon markups in your HTML pages. | |
gulp.task('inject-favicon-markups', function() { | |
return gulp.src(['app/*.html']) | |
.pipe(realFavicon.injectFaviconMarkups(JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).favicon.html_code)) | |
.pipe(gulp.dest('app')); | |
}); | |
// Check for updates on RealFaviconGenerator | |
gulp.task('check-for-favicon-update', function(done) { | |
var currentVersion = JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).version; | |
realFavicon.checkForUpdates(currentVersion, function(err) { | |
if (err) { | |
throw err; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment