Optimizing videos, photos, svgs from one folder to another.
Supported extensions:
JPG, JPEG, PNG, TIFF, SVG, MP4, MOV ...(more to be added)
There are other options like webpack, gulp, vite, nuxt/next plugins, etc. to optimize assets. This library makes optimizing assets framework agnostic, doesn't slow down building your app and gives you callbacks to customize what to do with the files and you don't have to rely on pre-coded options.
Drawbacks:
- with current implementation doesn't scale well for infinite number of file => use for large projects is not suitable at the moment
CLI
Programmable
npm install --location=global @sladdky/asset-optimizer
asset-optimizer
[--inputcwd=<path>] default: public-src
[--outputcwd=<path>] default: public
[--ui=<true|false>] default: false
npm install --save-dev @sladdky/asset-optimizer
const { join } = require('path')
const { createAssetOptimizer } = require('@sladdky/asset-optimizer')
const ao = createAssetOptimizer({
core: {
inputCwd: join(__dirname, 'public-src'),
outputCwd: join(__dirname, 'public'), //optimized|processed files
}
})
ao.watch()