@massimo-cassandro/create-favicons 1.3.3 → 1.3.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/create-favicons",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Favicon files builder",
5
5
  "bin": {
6
6
  "create-favicons": "./index.mjs"
package/readme.md CHANGED
@@ -6,6 +6,14 @@ I file da elaborare devono essere in formato SVG, mentre quelli generati sono in
6
6
 
7
7
  Le immagini sono generate con [Sharp](https://sharp.pixelplumbing.com/), [SVGO](https://github.com/svg/svgo) e [sharp-ico](https://github.com/ssnangua/sharp-ico).
8
8
 
9
+
10
+ ## Creazione template file di config (vedi più avanti)
11
+
12
+ ```bash
13
+ npx create-favicons init
14
+ ```
15
+
16
+
9
17
  ## Utilizzo
10
18
 
11
19
  ```bash
@@ -11,13 +11,13 @@ export async function createSnippet(params) {
11
11
  .replace('%_cache_buster_%', cache_buster);
12
12
 
13
13
 
14
- let snippet_content = `<link rel="icon" href="${create_href('favicon.ico')}" sizes="32x32">\n` +
15
- `<link rel="icon" href="${create_href('favicon.svg')}" type="image/svg+xml">\n` +
16
- `<link rel="apple-touch-icon" href="${create_href('apple-touch-icon.png')}">\n` +
17
- `<link rel="manifest" href="${create_href('manifest.webmanifest')}">`;
14
+ let snippet_content = `<link rel="icon" href="${create_href('favicon.ico')}" sizes="32x32"/>` +
15
+ `<link rel="icon" href="${create_href('favicon.svg')}" type="image/svg+xml"/>` +
16
+ `<link rel="apple-touch-icon" href="${create_href('apple-touch-icon.png')}"/>` +
17
+ `<link rel="manifest" href="${create_href('manifest.webmanifest')}"/>`;
18
18
 
19
19
  if (params.snippet_language === 'pug') {
20
- snippet_content = snippet_content.replace(/<link (.*?)>/g, 'link($1)');
20
+ snippet_content = snippet_content.replace(/<link (.*?)\/?>/g, 'link($1)');
21
21
  }
22
22
 
23
23
  snippet_content = params.snippet_template.replace('%_link_tags_%', snippet_content);
@@ -28,7 +28,7 @@ export async function createSnippet(params) {
28
28
  const targetFileContent = fs.readFileSync(params.snippet_target_file, 'utf8'),
29
29
  regexp = /<!-- ?favicon-snippet-start ?-->(.*?)<!-- ?favicon-snippet-end ?-->/mis;
30
30
 
31
- await fs.promises.writeFile(params.snippet_target_file,
31
+ fs.promises.writeFile(params.snippet_target_file,
32
32
  targetFileContent.replace(regexp,
33
33
  `<!-- favicon-snippet-start -->\n${snippet_content}\n<!-- favicon-snippet-end -->`
34
34
  )
@@ -40,7 +40,7 @@ export async function createSnippet(params) {
40
40
 
41
41
  } else {
42
42
 
43
- await fs.promises.writeFile(
43
+ fs.promises.writeFile(
44
44
  `${params.snippet_path}/${params.snippet_name}`,
45
45
  snippet_content
46
46
  );