All Projects → andreypopp → React Image Size Loader

andreypopp / React Image Size Loader

Webpack loader for images which turns them into <img /> components with height and width

Programming Languages

javascript
184084 projects - #8 most used programming language

React Image Size Loader

Webpack loader for images which generates React <img /> components with height and width attributes set.

Installation

% npm install react-image-size-loader

Webpack config example:

module.exports = {
  module: {
    loaders: [
      {
        test: /\.(gif|jpeg|jpg|png|svg)$/,
        loader: 'react-image-size-loader'
      }
    ]
  }
}

Code example:

import Logo from './cat.jpg'

React.render(<Logo />) // => <img width="300" height="188" src="cat.jpg" />
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].