@wault/asset-packer
v0.1.1
Published
Asset packing and optimization pipeline tools
Downloads
5
Readme
Asset Packer
WARNING: This project is under development. Current use is not recommended!
Asset packing and optimization tools.
Dependencies
Requires Node ver10.17.0
Note: pngquant-bin
might require additional dependencies
Linux:
$ sudo apt-get install libpng-dev
Windows:
$ npm install --global --production windows-build-tools
or download manually
Installation
With NPM
$ npm install --save-dev @wault/asset-packer
API
import { processAssets } from '@wault/asset-packer'
processAssets([
{ filename: 'file.ext', buffer: Buffer.from() }
], {
logger: true,
base64: {
prefix: '[hash]',
filter: filename => !/\.(png|jpg)$/i.test(filename)
},
spritesheet: {
prefix: '[hash]',
trim: true,
extrude: false,
downscale: 1,
group: {
colors: 4,
threshold: 4,
diminish: 0,
opaque: 0
},
pack: {
maxWidth: 2048,
maxHeight: 2048,
padding: 0,
border: 0,
pow2: true,
rotate: true
}
},
encoder: {
dithering: false,
quality: 80,
}
})
.then(files => {
//write files
})