Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fansenze/snowpack-plugin-inliner
A plugin for snowpack which transforms files into base64 URIs.
https://github.com/fansenze/snowpack-plugin-inliner
base64 image inliner snowpack snowpack-plugin url
Last synced: 20 days ago
JSON representation
A plugin for snowpack which transforms files into base64 URIs.
- Host: GitHub
- URL: https://github.com/fansenze/snowpack-plugin-inliner
- Owner: fansenze
- License: mit
- Created: 2020-08-07T11:37:58.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-09T02:58:00.000Z (about 3 years ago)
- Last Synced: 2024-11-29T02:16:09.760Z (27 days ago)
- Topics: base64, image, inliner, snowpack, snowpack-plugin, url
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# snowpack-plugin-inliner
A plugin for snowpack which transforms files into base64 URIs.## Usage
### Install
```bash
npm install --save-dev snowpack-plugin-inliner
```### Configuration
add this plugin to your Snowpack config:#### Commonly
**snowpack.config.json**
```json
{
"plugins": [
["snowpack-plugin-inliner"]
]
}
```#### Custom
**snowpack.config.js**
```javascript
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
}],
],
};
```## Options
| Name | Type | Default | Description |
| :---------------------------: | :-------------------------: | :----------------------------------------: | :---------------------------------------------------------------------------------- |
| **`exts`** | `Array` | `["jpg","jpeg","png","svg"]` | Specifying the extensions of a file will be inlined with. |
| **`limit`** | `boolean` / `number` / `string` | `10240` | Specifying the maximum size of a file in bytes. |
| **`encoding`** | `string` | `base64` | Specify the encoding which the file will be inlined with. |