@signalstickers/fetch-sticker-data-webpack-plugin
v1.0.0
Published
Webpack plugin which pre-loads sticker data at build-time.
Downloads
3
Readme
This Webpack plugin fetches sticker pack data from Signal at build-time, allowing the Signal Stickers website to load this data without having to fetch and decrypt it from the Signal API.
Install
npm i @signalstickers/fetch-sticker-data-webpack-plugin
Use
The plugin accepts 2 options, inputFile
and outputFile
. inputFile
should
be the path to a YAML file enumerating one or more StickerPackYaml
objects. outputFile
should be the desired path to a JSON file in the
compilation's output directory where the plugin will wite a list of StickerPackPartial
objects for each entry in inputFile
.
To enable the plugin, add it to your Webpack configuration:
import FetchStickerDataPlugin from '@signalstickers/fetch-sticker-data-webpack-plugin';
export default {
plugins: [new FetchStickerDataPlugin({
inputFile: 'stickers.yml',
outputFile: 'sticker-partials.json'
})]
}
Example:
The following stickers.yml
file will produce the below JSON output.
stickers.yml
---
ae1d343accdec586fe19954a6be7aee9:
key: ffea9831b6af7617e4ab1b3868ce6f26f5c7c8ab3f05fb8d68b436f9253232ab
source: ''
tags:
- cat
nsfw: false
sticker-partials.json
{
"meta": {
"id":"ae1d343accdec586fe19954a6be7aee9",
"key": "ffea9831b6af7617e4ab1b3868ce6f26f5c7c8ab3f05fb8d68b436f9253232ab",
"source":"",
"tags": [
"cat"
],
"nsfw":false
},
"manifest": {
"title": "Taffy Cat",
"author": "Dmitrii Nechitailo",
"cover": {
"id": 0,
"emoji": ""
}
}
}