@constgen/neutrino-image-loader

1.9.2 • Public • Published

@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()
   ]
}

/@constgen/neutrino-image-loader/

    Package Sidebar

    Install

    npm i @constgen/neutrino-image-loader

    Weekly Downloads

    20

    Version

    1.9.2

    License

    GPL-3.0

    Unpacked Size

    38.2 kB

    Total Files

    4

    Last publish

    Collaborators

    • constgen