Skip to content

erikdesjardins/prop-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prop-loader

Webpack loader to extract properties from JSON.

Based on json-loader.

Installation

npm install --save-dev prop-loader

Usage

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"]