@symph/joy-image

0.4.1 • Public • Published

Image Loader

Tt's an image loader for symphony-joy, we can require a image in jsx.

Installation

npm install --save @symph/joy-image

or

yarn add @symph/joy-image

Usage

<img src={require("./logo.jpg")}/>

Configuring

Create a joy.config.js in your project

// joy.config.js
const withImageLoader = require('@symph/joy-image')

module.exports = {
  plugins: [
    withImageLoader({limit: 8192})
  ]
}

Options

urlLoaderOptions

type: object, default:

{
  limit: 8192,
  publicPath: `${assetPrefix}/_symphony/static/images/`,
  outputPath: `${isServer ? "../" : ""}static/images/`,
  name: "[name]-[hash].[ext]"
}

For details, please see

ruleOptions

type: object, default:

{
  test: /\.(jpe?g|png|svg|gif)$/
}

We can used this to custom a rule in webpackConfig.module.rules, such as the properties test, include, exclude and resource etc.

Readme

Keywords

none

Package Sidebar

Install

npm i @symph/joy-image

Weekly Downloads

2

Version

0.4.1

License

MIT

Unpacked Size

2.81 kB

Total Files

3

Last publish

Collaborators

  • lnlfps