Skip to content

Commit 235bcd1

Browse files
authored
refactor: preparation for template inheritance (#5)
1 parent 7215868 commit 235bcd1

File tree

30 files changed

+236
-12
lines changed

30 files changed

+236
-12
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
const content = ["Initial content"];
22

3-
export { content };
3+
export default content;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
employees:
2+
- id: 1
3+
name: John Doe
4+
job: Developer
5+
skills:
6+
- JavaScript
7+
- Python
8+
- C++
9+
- id: 2
10+
name: Jane Doe
11+
job: Designer
12+
skills:
13+
- Photoshop
14+
- Illustrator
15+
- InDesign
16+
projects:
17+
- id: 101
18+
name: Project Alpha
19+
description: This is the first project.
20+
- id: 102
21+
name: Project Beta
22+
description: This is the second project.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import content from "./content.yaml";
22

3-
export { content };
3+
export default content;

src/content/tutorial/1-vite-plugin/1-yaml-plugin/1-importing-yaml-files/content.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Our goal is to be able to import `content.yaml` file in a Javascript file and us
1616
import content from "./content.yaml";
1717

1818
console.log(content);
19-
// > [{ employees: [{ id: 1, ...}, ...], projects: { id: 101, ...}, ... }]
19+
// > [{ employees: [{ id: 1, ... }, ...], projects: [{ id: 101, ...}, ...] }]
2020
```
2121

2222
Try doing this in `index.js`:
@@ -25,7 +25,7 @@ Try doing this in `index.js`:
2525
import content from "./content.yaml";
2626
const content = ["Initial content"];
2727

28-
export { content };
28+
export default content;
2929
```
3030

3131
At this point we should run into error when Vite fails to load `.yaml` file. 
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import content from "./content.yaml";
22

3-
export { content };
3+
export default content;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import content from "./content.yaml";
2+
3+
export default content;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import content from "./content.yaml";
22

3-
export { content };
3+
export default content;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
employees:
2+
- id: 1
3+
name: John Doe
4+
job: Developer
5+
skills:
6+
- JavaScript
7+
- Python
8+
- C++
9+
- id: 2
10+
name: Jane Doe
11+
job: Designer
12+
skills:
13+
- Photoshop
14+
- Illustrator
15+
- InDesign
16+
projects:
17+
- id: 101
18+
name: Project Alpha
19+
description: This is the first project.
20+
- id: 102
21+
name: Project Beta
22+
description: This is the second project.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import content from "./content.yaml";
2+
3+
export default content;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import content from "./content.yaml";
22

3-
export { content };
3+
export default content;

0 commit comments

Comments
 (0)