@saiballo/eleventy-plugin-favicon-factory 1.0.2 → 1.0.4
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/README.md +4 -0
- package/package.json +1 -1
- package/src/favicon.js +13 -7
package/README.md
CHANGED
|
@@ -107,6 +107,10 @@ In your template you can add a shortcut (the example below is for Nunjucks). The
|
|
|
107
107
|
{% favicon "path/to/your/image/favicon.svg" %}
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
+
## Note
|
|
111
|
+
|
|
112
|
+
If an error occurred or you want to regenerate all the icons, always remember to delete the destination folder "outputFolder" if it has already been created — otherwise, the icons will not be generated.
|
|
113
|
+
|
|
110
114
|
## Team ARMADA 429
|
|
111
115
|
<img src="https://raw.githubusercontent.com/saiballo/saiballo/refs/heads/master/armada429.png" width="100" height="100">
|
|
112
116
|
|
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
|
};
|