1.0.0 • Published 4 years ago

snowpack-plugin-url-loader v1.0.0

Weekly downloads
8
License
ISC
Repository
github
Last release
4 years ago

snowpack-plugin-url-loader

url loader for snowpack, use base64 encode file

Usage

Install

npm install --save-dev snowpack-plugin-url-loader

Configuration

add this plugin to your Snowpack config:

Commonly

snowpack.config.json

{
  "plugins": [
    ["snowpack-plugin-url-loader"]
  ]
}

Custom

snowpack.config.json

{
  "plugins": [
    ["snowpack-plugin-url-loader", {
      "exts": ["jpg", "png"], // only "jpg" & "png" will be inlined with
      "limit": 66666, // set maximum of file size: 66666 bytes
    }]
  ]
}

Options

NameTypeDefaultDescription
extsArray<string>["jpg","jpeg","png","svg"]Specifying the extensions of a file will be inlined with.
limitboolean | number | string10240Specifying the maximum size of a file in bytes.
encodingstringbase64Specify the encoding which the file will be inlined with.