andlrc / json_merger Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
I think it would be very handy to use this tool as loader for webpack.
for example:
preLoaders: [
{
test: /\.json$/,
loader: 'json_merger',
}
],
So, it will be possible to generate .json from the pieces during the build.
But, webpack sends to the loader function only content and not path to the file.
So, how about to add one more public method (compile/generate/interpolate), which will take json, working context and will return the generated result.
for example:
var result = json_merger.compile(json, {
context: __dirname + '/some/path';
});
I've created webpack loader based on your tool: https://github.com/kopach/json_merger-loader
And now I would like to update it to have an ability to auto recompile files if something got changes. To do so I would need to get somehow all touched files. For example, if fileA.json
uses ./path/fileB.json
which uses ./fileC.json
and so on, I would like to have the list of next files with related to the main file fileA.json
paths. In this case it would be like so:
['./path/fileB.json', './path/fileC.json']
Is there any chance to update json_merger
to have such functionality? The interface I can imagine may look like this:
var merger = json_merger(json, {
scope: '/some/path';
});
var paths = merger.getListOfTouchedFiles();
var result = merger.merge();
Is there a way to remove items from object or array?
Perhaps something along these lines:
animals.json
{
"animals": ["dog", "cat", "lion"]
}
pets.json
{
"@extends": "animals.json",
"@subtract": ["animals"],
"animals": ["tiger"]
}
json_merger pets.json
{
"animals": ["dog", "cat"]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.