0.6.0 • Published 3 years ago

blurhash-loader v0.6.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

blurhash-loader

A blurhash loader module for webpack.

Install

$ npm install -D blurhash-loader

or

$ yarn add -D blurhash-loader

Usage

webpack.config.js

module.exports = {
  module: {
    rules: [
      test: /\.(?:gif|jpe?g|png|webp)$/i,
      use: [
        {
          loader: 'blurhash-loader',
          options: {
            componentX: 4,
            componentY: 3
          }
        }
      ]
    ]
  }
}

index.tsx

import { Blurhash } from 'react-blurhash'
import photo, { blurhash } from './photo.jpg'

export default function Home() {
  return (
    <div>
      <Blurhash hash={blurhash} height={600} width={800} />
    </div>
  )
}

Options

NameTypeDefaultDescription
componentX{Number}4A componentX is the value passed directly to blurhash.
componentY{Number}3A componentY is the value passed directly to blurhash.
context{String}loaderContext.rootContextA custom file context.
emitFile{Boolean}trueDon't emit the file if false is specified.
esModule{Boolean}trueIf enabled, use the ES modules syntax.
name{String\|Function}'[contenthash].[ext]'The filename template for the target file.
outputPath{String\|Function}undefinedA custom output path for the target file.
publicPath{String\|Function}undefinedA custom public path for the target file.

License

MIT

0.6.0

3 years ago

0.5.2

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.5.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago