npm.io
1.1.3 • Published 6d ago

rollup-plugin-websqz

Licence
MIT
Version
1.1.3
Deps
2
Size
35 kB
Vulns
0
Weekly
14
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

rollup-plugin-websqz

NPM Version

Rollup / Vite plugin for using websqz to compress and bundle code and assets into one HTML file. This is intented for intros in the demoscene or size restricted JS challenges.

Install

npm i rollup-plugin-websqz

Usage

// vite.config.js
import { defineConfig } from 'vite';
import websqz from 'rollup-plugin-websqz';

export default defineConfig({
  plugins: [websqz()]
});

See the example for a working example with support for vite-plugin-glsl.

Example Options

websqz({
    /*
    Full path to the websqz executable.
    If null (default), the plugin uses the websqz executable
    installed when installing the npm package.
    Otherwise it will try to resolve websqz from your system PATH.
    */
    websqzPath: null,
    fileTransforms: [
        {
            include: /\.glsl$/,
            transform: async (ctx, id, content) => {
                return {
                    content: Buffer.from("Hello World", "utf-8"),
                    isCompressed: false,
                    isText: true,
                    fileExt: ".glsl" // Optional
                };
            }
        }
    ]
})

Keywords