我想做一个循环,将:
就像您可以看到的那样,这只是一个更大构建的一部分。现在我有这个:
图标生成器
// Generate the icons. This task takes a few seconds to complete.
gulp.task('generate-favicon', function(done) {
realFavicon.generateFavicon({
masterPicture: './app/static/android-chrome-550x550.png',
dest: './app/static/',
iconsPath: '/',
design: {
ios: {
masterPicture: {
type: 'inline',
content: 'icon'
},
pictureAspect: 'backgroundAndMargin',
backgroundColor: '#151515',
margin: '21%',
assets: {
ios6AndPriorIcons: false,
ios7AndLaterIcons: false,
precomposedIcons: false,
declareOnlyDefaultIcon: true
}
},
desktopBrowser: {},
windows: {
pictureAspect: 'whiteSilhouette',
backgroundColor: '#414141',
onConflict: 'override',
assets: {
windows80Ie10Tile: false,
windows10Ie11EdgeTiles: {
small: false,
medium: true,
big: false,
rectangle: false
}
}
},
androidChrome: {
masterPicture: {
type: 'inline',
content:'icon'
},
pictureAspect: 'backgroundAndMargin',
margin: '10%',
backgroundColor: '#313131',
themeColor: '#101010',
manifest: {
},
assets: {
legacyIcon: false,
lowResolutionIcons: true
}
},
safariPinnedTab: {
pictureAspect: 'silhouette',
themeColor: '#414141'
}
},
settings: {
compression: 4,
scalingAlgorithm: 'Mitchell',
errorOnImageTooSmall: false,
readmeFile: false,
htmlCodeFile: true,
usePathAsIs: false
},
markupFile: FAVICON_DATA_FILE
}, function() {
done();
});
});
网站图标更新程序
gulp.task('favicon-checker', function(done) {
var currentVersion = JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).version;
realFavicon.checkForUpdates(currentVersion, function(err) {
if (err) {
gulp.start('generate-favicon');
}
});
});
我用gulp.start修改默认更新
Gulp任务
gulp.task('publish', function(callback) {
runSequence('masterclean', ['fonts', 'scss', 'modernizr', 'javascript', 'javascript-spec', 'static'], ['favicon-checker'], ['html_move'], ['add_favicons'], ['add_partials'], ['sitemap'], ['pages'], ['base64'], ['html-inline-critical'], ['purgecss'], ['mozjpeg'], ['version_cache'], ['clean_temp'], ['clean_fav_code'],
callback);
});
现在,如果我运行“ gulp publish”,它将在“ favicon-checker”之后停止。如果没有带图标信息的json,它将停止并引发错误。
我正在使用: CLI版本:2.2.0 本地版本:3.9.1