A plugin for snowpack which transforms files into base64 URIs.
npm install --save-dev snowpack-plugin-inliner
add this plugin to your Snowpack config:
snowpack.config.json
{
"plugins": [
["snowpack-plugin-inliner"]
]
}
snowpack.config.js
module.exports = {
"plugins": [
["snowpack-plugin-inliner", {
"exts": ["jpg", "png"], // only "jpg" & "png" will be inlined with
"limit": 66666, // set maximum of file size: 66666 bytes
}],
],
};
Name | Type | Default | Description |
---|---|---|---|
exts |
Array<string> |
["jpg","jpeg","png","svg"] |
Specifying the extensions of a file will be inlined with. |
limit |
`boolean | number | string` |
encoding |
string |
base64 |
Specify the encoding which the file will be inlined with. |