1.9.2 • Published 4 years ago

@constgen/neutrino-image-loader v1.9.2

Weekly downloads
18
License
GPL-3.0
Repository
github
Last release
4 years ago

@constgen/neutrino-image-loader

npm npm

Neutrino middleware for image files

Requirements

  • Node.js v10+
  • Neutrino v9
  • Webpack v4

Installation

@constgen/neutrino-image-loader can be installed from NPM. You should install it to "dependencies" (--save) or "devDependncies" (--save-dev) depending on your goal.

npm install --save @constgen/neutrino-image-loader

Usage

In preset

Require this package and plug it into Neutrino. The following shows how you can pass an options object to the middleware, showing the defaults:

let imageLoader = require('@constgen/neutrino-image-loader')

neutrino.use(imageLoader({
   limit: 10000 // 10 KB - images lesser than this size in bytes will be Base64 encoded into JS bundle
}))

In neutrinorc

The middleware also may be used together with another presets in Neutrino rc-file, e.g.:

.neutrinorc.js

let imageLoader = require('@constgen/neutrino-image-loader')

module.exports = {
   use: [
      imageLoader()
   ]
}