{"library":"spglsl","title":"spglsl","type":"library","description":"spglsl (v0.3.1) is a WebGL GLSL minifier and compiler based on Google ANGLE. It preprocesses directives, removes whitespace, applies constant folding, and mangles non-exported functions and variable names. Optimized for js13k game jams and similar size-constrained WebGL projects, it is distributed as a precompiled WASM binary via npm, runs on Node.js (>=14.17.4), and includes Rollup/Vite plugins. Unlike other GLSL minifiers (e.g., glsl-minify), spglsl provides full ANGLE-based compilation validation and controllable mangling via globals map. Release cadence is low; last major update 2022.","language":"javascript","status":"maintenance","last_verified":"Fri May 01","install":{"commands":["npm install spglsl"],"cli":{"name":"spglsl","version":null}},"imports":["import { spglslAngleCompile } from 'spglsl'","import { rollupPluginSpglsl } from 'spglsl'","import type { SpglslAngleCompileOptions } from 'spglsl'"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/SalvatorePreviti/spglsl","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/spglsl","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import { spglslAngleCompile } from 'spglsl';\nimport { readFileSync } from 'fs';\n\nasync function main() {\n  const result = await spglslAngleCompile({\n    mainFilePath: 'shader.frag',\n    mainSourceCode: readFileSync('shader.frag', 'utf8'),\n    minify: true,\n    mangle: true,\n    mangle_global_map: { myUniform: 'u', myVarying: 'v' }\n  });\n  if (!result.valid) {\n    console.error(result.infoLog);\n    throw new Error('Compilation failed');\n  }\n  console.log(result.output);\n}\nmain().catch(console.error);","lang":"typescript","description":"Minifies and mangles a GLSL fragment shader using spglsl, with renamed uniforms and varying.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}