@ingredient-icons/core 0.1.0 → 0.1.2

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 CHANGED
@@ -9,13 +9,32 @@ npm install @ingredient-icons/core
9
9
  ```ts
10
10
  import { findIcon, iconName, iconUrl } from "@ingredient-icons/core"
11
11
 
12
- iconUrl("en:shallot") // https://cdn.jsdelivr.net/npm/@ingredient-icons/core@0.1.0/icons/webp/128/en_shallot.webp
12
+ iconUrl("en:shallot") // https://cdn.jsdelivr.net/npm/@ingredient-icons/core@<version>/icons/webp/128/en_shallot.webp
13
13
  iconUrl("en:cherry-tomato", { size: 64 }) // the tomato's icon
14
14
  findIcon("en:cherry-tomato") // { id: "en:tomato", file: "en_tomato", exact: false }
15
15
  iconName("en:shallot", "fr") // "échalote"
16
16
  ```
17
17
 
18
- Icons ship as transparent WebP in 64, 128 and 256 px, under `icons/webp/{size}/`. URLs default to the jsDelivr CDN, pinned to the installed version; to serve the files yourself, expose the package's `icons/` folder and pass `{ baseUrl }`.
18
+ Icons ship as transparent WebP in 64, 128 and 256 px, under `icons/webp/{size}/`. URLs default to the jsDelivr CDN, pinned to the installed version.
19
+
20
+ ## Serving the files yourself
21
+
22
+ Expose the package's `icons/` folder and pass `{ baseUrl }`. With Express:
23
+
24
+ ```ts
25
+ import { createRequire } from "node:module"
26
+ import path from "node:path"
27
+ import express from "express"
28
+ import { iconUrl } from "@ingredient-icons/core"
29
+
30
+ const root = path.dirname(createRequire(import.meta.url).resolve("@ingredient-icons/core/package.json"))
31
+ const app = express()
32
+ app.use("/ingredient-icons/icons", express.static(path.join(root, "icons"), { immutable: true, maxAge: "1y" }))
33
+
34
+ iconUrl("en:shallot", { baseUrl: "https://api.example.com/ingredient-icons" })
35
+ ```
36
+
37
+ An icon can change between versions: if you cache forever, put the package version (`VERSION`) in the path.
19
38
 
20
39
  ## Licenses
21
40
 
package/dist/data.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "0.1.0";
1
+ export declare const VERSION = "0.1.2";
2
2
  export declare const STYLE = 1;
3
3
  export declare const SIZES: readonly [64, 128, 256];
4
4
  export declare const TAXONOMY_COMMIT = "234008a0a245781a449c8dc975be3416fef1a3ef";