@saiballo/eleventy-plugin-favicon-factory 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/favicon.js +13 -7
package/package.json
CHANGED
package/src/favicon.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Created: 15/04/2024 (18:41:03)
|
|
6
6
|
* Created by: Lorenzo Saibal Forti <lorenzo.forti@gmail.com>
|
|
7
7
|
*
|
|
8
|
-
* Last update:
|
|
8
|
+
* Last update: 24/04/2025 (15:35:49)
|
|
9
9
|
* Updated by: Lorenzo Saibal Forti <lorenzo.forti@gmail.com>
|
|
10
10
|
*
|
|
11
11
|
* Copyleft: 2024 - Tutti i diritti riservati
|
|
@@ -144,18 +144,22 @@ const favicon = (eleventyconfig, pluginconfig) => {
|
|
|
144
144
|
|
|
145
145
|
try {
|
|
146
146
|
|
|
147
|
+
// check if the source image exists
|
|
148
|
+
const isValidSource = await util.isFile(sourceimg);
|
|
149
|
+
// if it doesn't exist, i can't proceed
|
|
150
|
+
if (!isValidSource) {
|
|
151
|
+
|
|
152
|
+
toLog("source image not found. can't process favicon list", "error");
|
|
153
|
+
|
|
154
|
+
return "[plugin-favicon-factory - source image not found]";
|
|
155
|
+
}
|
|
156
|
+
|
|
147
157
|
const outputDir = path.join(eleventyconfig.dir.output, pluginconfig.outputFolder);
|
|
148
158
|
const isOutputFolder = await util.isFolder(outputDir);
|
|
149
159
|
|
|
150
160
|
// if the folder didn't exist, it was created and therefore the favicons must be processed or the build is done
|
|
151
161
|
if (!isOutputFolder || process.env.NODE_ENV === "production") {
|
|
152
162
|
|
|
153
|
-
// check if the source image exists
|
|
154
|
-
const isValidSource = await util.isFile(sourceimg);
|
|
155
|
-
|
|
156
|
-
// if it doesn't exist, i can't proceed
|
|
157
|
-
if (!isValidSource) return false;
|
|
158
|
-
|
|
159
163
|
toLog("starting favicons creation...", "info");
|
|
160
164
|
|
|
161
165
|
util.copyFile(sourceimg, `${outputDir}/${pluginconfig.prefixName}.svg`);
|
|
@@ -203,6 +207,8 @@ const favicon = (eleventyconfig, pluginconfig) => {
|
|
|
203
207
|
} catch (err) {
|
|
204
208
|
|
|
205
209
|
toLog(`${err["message"]}`, "error");
|
|
210
|
+
|
|
211
|
+
return `[plugin-favicon-factory - ${err["message"]}]`;
|
|
206
212
|
}
|
|
207
213
|
});
|
|
208
214
|
};
|