@ingredient-icons/core 0.1.0 → 0.1.1
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 +21 -2
- package/dist/data.d.ts +1 -1
- package/dist/data.js +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
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
|
|
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
|
|
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
package/dist/data.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate.ts from manifest.json and taxonomy.json: do not edit.
|
|
2
|
-
export const VERSION = "0.1.
|
|
2
|
+
export const VERSION = "0.1.1";
|
|
3
3
|
export const STYLE = 1;
|
|
4
4
|
export const SIZES = [64, 128, 256];
|
|
5
5
|
export const TAXONOMY_COMMIT = "234008a0a245781a449c8dc975be3416fef1a3ef";
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare function findIcon(id: string): Icon | undefined;
|
|
|
21
21
|
/** Path of an icon inside the package: "icons/webp/128/en_shallot.webp". */
|
|
22
22
|
export declare function iconPath(id: string, size?: IconSize): string | undefined;
|
|
23
23
|
/** Default CDN, pinned to this package's version so URLs never change under you. */
|
|
24
|
-
export declare const CDN_URL = "https://cdn.jsdelivr.net/npm/@ingredient-icons/core@0.1.
|
|
24
|
+
export declare const CDN_URL = "https://cdn.jsdelivr.net/npm/@ingredient-icons/core@0.1.1";
|
|
25
25
|
/**
|
|
26
26
|
* URL of an icon. Pass `baseUrl` to serve the package's `icons/` folder yourself
|
|
27
27
|
* instead of the public CDN.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ingredient-icons/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Soft 3D icons for cooking ingredients, keyed by the Open Food Facts taxonomy, with ancestor fallback",
|
|
5
5
|
"license": "(MIT AND CC0-1.0 AND ODbL-1.0)",
|
|
6
6
|
"type": "module",
|