/uniform-props-webpack-plugin

Add one extra prop to all elements, which created by `React.createElement`.

Primary LanguageJavaScript

npm tests Join the chat at https://gitter.im/uniform-props-webpack-plugin/Lobby

Uniform Props Plugin

 

Add extra props to all elements, which created by `React.createElement`.

Introduction

uniform-props-webpack-plugin is a webpack plugin, which allows you to inject one property to all react elements. You can inject only one property at present, I'll consider whether I should make it support multi properties or maybe not. This plugin is not as good as what I need, because the injected property will apply to all react elements, some of the elements maybe not support the property, so you'd better treat uniform-props-webpack-plugin as an temporary alternative;

Install

Install with npm:

npm install --save-dev uniform-props-webpack-plugin

Usage

module.exports = {
  entry: "./index.js",
  output: {
    filename: '[name].js',
  },
  plugins: [
    new UniformPropsPlugin({ size: 'small' })
  ]
}

License

MIT