Webpack loader to extract properties from JSON.
Based on json-loader
.
npm install --save-dev prop-loader
manifest.json:
{
"version": "1.2.3",
"background": {
"scripts": ["background.js"]
}
}
example.js:
var everything = require('prop-loader!manifest.json');
// everything === { "version": "1.2.3", "background": { "scripts": ["background.js"] } }
var version = require('prop-loader?version!manifest.json')
// version === "1.2.3";
var scripts = require('prop-loader?background.scripts!manifest.json')
// scripts === ["background.js"]