vite-plugin-yaml icon indicating copy to clipboard operation
vite-plugin-yaml copied to clipboard

Possible to include other yaml-files inside a yaml-file?

Open Dylan190774 opened this issue 2 years ago • 2 comments
trafficstars

I'm looking for a way to separate my yaml-files into different files and combine them into 1 big yaml-file.

The yaml-loader I used for Webpack was able to do this : https://github.com/ngfk/yaml-import-loader The !import statement proved to be very powerful. I would love to have this with this loader as well.

Are there any plans to add something like this?

Dylan190774 avatar Aug 29 '23 22:08 Dylan190774

Apologies for the months-late reply - this is an interesting concept that we're open to supporting! I would love to know more details on the most desirable combination mechanism and some example use cases.

What would the desired behavior be around duplicate keys? Should they cascade where (for example)

!import ./import-1.yml
!import ./import-2.yml

import-2 overrides any keys of the same value in import-1? Similar to in JS:

console.log(
  {
  foo: 'bar',
  ...{foo: 2}
  }
); // -> foo: 2

tonyketcham avatar Jan 17 '24 20:01 tonyketcham

Yeah, I guess the second would override previous declared values. However, I want to combine different sections into one file, and will not override values anyway.

Dylan190774 avatar May 06 '24 17:05 Dylan190774