vuejs read yaml code example

Example 1: vue import yaml

yarn add --dev vue-cli-plugin-yaml

Example 2: how to pass yaml data to vue file

// .vue file
// must have yaml-loader installed as a dependency
// place folowing block between <script></script>

import AppConfig from "@/assets/config.yaml"; // gets data from yaml config

export default {
  name: "HelloWorld",
  props: {
    msg: String,
  },
  data() {
    return {
      // can use moustaches or v-bind to dynamically inject data in template
      url: AppConfig.author["name"],
      repo: AppConfig.repo,
    };
  },
};