Skip to content

Commit

Permalink
Revert "Maryia/Loading favicons based on size & excluded them from se…
Browse files Browse the repository at this point in the history
…rvice worker (deriv-com#5172)" (deriv-com#5177)

This reverts commit 5a552f6.
  • Loading branch information
matin-deriv authored Apr 11, 2022
1 parent c049105 commit 699dc4a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
30 changes: 4 additions & 26 deletions packages/core/build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const copyConfig = base => {
to: 'favicon.ico',
toType: 'file',
},
{ from: path.resolve(__dirname, '../src/public/images/favicons/'), to: 'public/images/favicons/' },
{ from: path.resolve(__dirname, '../src/public/images/favicons/'), to: 'public/images/favicons' },
{
from: path.resolve(__dirname, '../src/public/images/common/static_images/'),
to: 'public/images/common',
Expand Down Expand Up @@ -132,8 +132,6 @@ const generateSWConfig = is_release => ({
/sitemap\.xml$/,
/robots\.txt$/,
/manifest\.json$/,
/^public\/images\/favicons\//,
/^favicon\.ico$/,
/^apple-app-site-association/,
/^assetlinks.json/,
/^.well-known\//,
Expand Down Expand Up @@ -182,33 +180,13 @@ const htmlInjectConfig = () => ({
},
},
{
path: 'favicon.ico',
path: 'public/images/favicons',
glob: '*',
globPath: path.resolve(__dirname, '../src/public/images/favicons'),
attributes: {
rel: 'icon',
},
},
...[
{ name: 'favicon', rel: 'icon', size: '16' },
{ name: 'favicon', rel: 'icon', size: '32' },
{ name: 'favicon', rel: 'icon', size: '96' },
{ name: 'favicon', rel: 'icon', size: '160' },
{ name: 'favicon', rel: 'icon', size: '192' },
{ name: 'apple-touch-icon', size: '57' },
{ name: 'apple-touch-icon', size: '60' },
{ name: 'apple-touch-icon', size: '72' },
{ name: 'apple-touch-icon', size: '76' },
{ name: 'apple-touch-icon', size: '114' },
{ name: 'apple-touch-icon', size: '120' },
{ name: 'apple-touch-icon', size: '144' },
{ name: 'apple-touch-icon', size: '152' },
{ name: 'apple-touch-icon', size: '180' },
].map(({ name, rel, size }) => ({
path: `public/images/favicons/${name}-${size}.png`,
attributes: {
rel: rel || name,
sizes: `${size}x${size}`,
},
})),
],
append: false,
});
Expand Down
17 changes: 16 additions & 1 deletion packages/trader/build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { IS_RELEASE } = require('./constants');
const generateSWConfig = () => ({
importWorkboxFrom: 'local',
cleanupOutdatedCaches: true,
exclude: [/CNAME$/, /index\.html$/, /404\.html$/, /^public\/images\/favicons\//, /^favicon\.ico$/],
exclude: [/CNAME$/, /index\.html$/, /404\.html$/],
skipWaiting: true,
clientsClaim: true,
});
Expand All @@ -24,6 +24,20 @@ const htmlOutputConfig = () => ({
},
});

const htmlInjectConfig = () => ({
links: [
{
path: 'public/images/favicons',
glob: '*',
globPath: path.resolve(__dirname, '../src/public/images/favicons'),
attributes: {
rel: 'icon',
},
},
],
append: false,
});

const cssConfig = () => ({
filename: 'trader/css/trader.main.[contenthash].css',
chunkFilename: 'trader/css/trader.[name].[contenthash].css',
Expand All @@ -38,6 +52,7 @@ const stylelintConfig = () => ({

module.exports = {
htmlOutputConfig,
htmlInjectConfig,
cssConfig,
stylelintConfig,
generateSWConfig,
Expand Down

0 comments on commit 699dc4a

Please sign in to comment.