Comments (1)
This would be handy if it worked -- unfortunately, it won't at this point without some modding on js-yaml
itself.
yaml-include
doesn't concatenate all the included files and then process them as the final document. Instead, it processes each file and builds an object with the result. Since each file is a new yaml.load()
call, and since js-yaml
does not support persisting anchors between file loads, aliases in separate files are considered unidentified.
I've been thinking of ways around this. One might be a special !!inc/alias
type of inclusion, which would load the anchors and then expose an object where the values could be retrieved by key in all subsequently included files.
Another would be to extend js-yaml
and overwrite the loader functionality to force the exposure of found anchors across subsequent files. Sort of a stateful loader.
A third way would be simply making an aliases object part of configuration, and passing those into each loaded yaml doc. The problem with this and the !!inc/alias
approach is that it forces an unnatural (from the yaml perspective) definition of anchors. YAML 1.2 as-is allows the anchor declaration anywhere for first use, so long as it appears before the second use in the stream.
The second approach I'm describing here could support that, but it feels like the hairiest approach. I'll continue kicking it around and see if some easy solution presents itself. 😄
from yaml-include.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yaml-include.