@sladdky/asset-optimizer
TypeScript icon, indicating that this package has built-in type declarations

0.6.10 • Public • Published

ASSET-OPTIMIZER

Optimizing videos, photos, svgs from one folder to another.

Supported extensions:
JPG, JPEG, PNG, TIFF, SVG, MP4, MOV ...(more to be added)


Why?

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

Table of contents

CLI


Programmable




CLI

Instalation

npm install --location=global @sladdky/asset-optimizer

Usage

asset-optimizer
            [--inputcwd=<path>]   default: public-src
            [--outputcwd=<path>]  default: public
            [--ui=<true|false>]   default: false

Programmable

Instalation

npm install --save-dev @sladdky/asset-optimizer

Usage

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()

Package Sidebar

Install

npm i @sladdky/asset-optimizer

Weekly Downloads

9

Version

0.6.10

License

MIT

Unpacked Size

2.42 MB

Total Files

181

Last publish

Collaborators

  • sladdky