Skip to content

Commit 12637ce

Browse files
committed
Fix auto favicon generator config
1 parent 27d304b commit 12637ce

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

webpack.config.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
const path = require("path");
2-
const { basename } = require("path");
32
const WebpackBar = require("webpackbar");
43
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
54
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
65
const TerserPlugin = require("terser-webpack-plugin");
76
const FileManagerPlugin = require("filemanager-webpack-plugin");
87
const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
9-
const { extendDefaultPlugins } = require("svgo");
10-
const { cp } = require("fs");
11-
const sass = require("sass-embedded");
8+
const fs = require("fs");
129
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
13-
const HtmlWebpackPlugin = require("html-webpack-plugin");
1410
const BASE_PATH = path.resolve(__dirname, ".");
1511

1612
module.exports = (env, argv) => {
@@ -86,29 +82,33 @@ module.exports = (env, argv) => {
8682
// template: THEME_PATH + '/index.html',
8783
// filename: 'index.html',
8884
// }),
89-
new FaviconsWebpackPlugin({
90-
logo: THEME_PATH + "/icons/logo.png",
91-
mode: "webapp",
92-
cache: false,
93-
outputPath: THEME_PATH + "/icons",
94-
inject: false,
95-
favicons: {
96-
appName: null, // Your application's name. `string`
97-
appShortName: null, // Your application's short_name. `string`. Optional. If not set, appName will be used
98-
appDescription: null, // Your application's description. `string`
99-
developerName: null, // Your (or your developer's) name. `string`
100-
developerURL: null, // Your (or your developer's) URL. `string`
101-
loadManifestWithCredentials: false,
102-
icons: {
103-
android: true, // Create Android homescreen icon. `boolean` or `{ offset, background }` or an array of sources
104-
appleIcon: true, // Create Apple touch icons. `boolean` or `{ offset, background }` or an array of sources
105-
appleStartup: false, // Create Apple startup images. `boolean` or `{ offset, background }` or an array of sources
106-
favicons: true, // Create regular favicons. `boolean` or `{ offset, background }` or an array of sources
107-
windows: false, // Create Windows 8 tile icons. `boolean` or `{ offset, background }` or an array of sources
108-
yandex: false, // Create Yandex browser icon. `boolean` or `{ offset, background }` or an array of sources
109-
},
110-
},
111-
}),
85+
...(fs.existsSync(THEME_PATH + "/icons/logo.png")
86+
? [
87+
new FaviconsWebpackPlugin({
88+
logo: THEME_PATH + "/icons/logo.png",
89+
mode: "webapp",
90+
cache: false,
91+
outputPath: THEME_PATH + "/icons",
92+
inject: false,
93+
favicons: {
94+
appName: null,
95+
appShortName: null,
96+
appDescription: null,
97+
developerName: null,
98+
developerURL: null,
99+
loadManifestWithCredentials: false,
100+
icons: {
101+
android: true,
102+
appleIcon: true,
103+
appleStartup: false,
104+
favicons: true,
105+
windows: false,
106+
yandex: false,
107+
},
108+
},
109+
}),
110+
]
111+
: []),
112112
].filter(Boolean),
113113
module: {
114114
rules: [

0 commit comments

Comments
 (0)