@yysng/astro-boilerplate 1.1.8 → 1.1.9
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/content-system/loader.js +23 -13
package/package.json
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
// src/content-system/loader.js
|
|
2
|
+
|
|
3
|
+
import hero from "../content/hero.json";
|
|
4
|
+
import cta from "../content/cta.json";
|
|
5
|
+
import about from "../content/about.json";
|
|
6
|
+
import testimonials from "../content/testimonials.json";
|
|
7
|
+
|
|
8
|
+
const CONTENT_CACHE = {
|
|
9
|
+
hero,
|
|
10
|
+
cta,
|
|
11
|
+
about,
|
|
12
|
+
testimonials
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function loadContent(key) {
|
|
16
|
+
const data = CONTENT_CACHE[key];
|
|
17
|
+
|
|
18
|
+
if (!data) {
|
|
19
|
+
throw new Error(`Unknown content key: ${key}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return data;
|
|
23
|
+
}
|