I have a simple vuepress website, and I'm reading a .json
file on the index.md
using;
{{ require('./nba.json') }}
It works fine and looks like the image attached;
As you can see it doesn't look the best. In vuepress how can I specifically style what is being read from json, ie. change the font size, display the info in a neat way etc?
In Vuepress (and Vue + Webpack in general) imported
json
files are just JavaScript objects so you can use it with Vue to generate anything you want...There are two ways how to use this code.
docs/.vuepress/components
directory asNbaMatches.vue
- it becomes global component and can be used inside anymd
file as<NbaMatches />
(you will need to wrap the template part - everything above<script>
- into<template></template>
)md
file directly as is and it should work