Skip to content
PluginStats

compress-shader-literals weekly downloads statistics

By jayf0x · npm · Webpack plugins

✂️ Strip comments & whitespace from GLSL/WGSL shader literals in your JS/TS at build time — any bundler, no toolchain, no runtime cost.

View on npm Fresh · Oct 18, 2026

compress-shader-literals has 22 recorded weekly downloads on npm, a decrease of 65.6% over the past 30 days, ranking #1924 of 2,322 tracked listings.

Weekly downloads
22
Official API · Oct 18, 2026
7-day growth
-4.3%
-1 weekly downloads
30-day growth
-65.6%
-42 weekly downloads
90-day growth
-91.1%
-226 weekly downloads
Rank
#1924
Among tracked npm listings

About compress-shader-literals

compress-shader-literals

Size matters. Strip everything strippable from your GLSL & WGSL shaders at build time.

npm version minzipped size npm downloads license

A tiny build-time minifier for GLSL & WGSL shaders written as template literals in your JS/TS. Strips comments + whitespace — any bundler, no renaming, no toolchain, no runtime cost.

Alt Preview

Install

<!-- [![NPM](https://nodei.co/npm/compress-shader-literals.png)](https://www.npmjs.com/package/compress-shader-literals) -->
bun add -d compress-shader-literals

About

  • Removes comments, collapses whitespace, joins statements, and trims space around delimiters. Whitespace and comments only.
  • No renaming, no dead-code removal, no operator-space removal — output stays valid.
  • Runs before your bundler's own minifier.

Usage

One unplugin plugin, same API for every bundler:

import { compressShaderLiterals } from 'compress-shader-literals';

// vite.config.js
export default { plugins: [compressShaderLiterals.vite({ outputRatio: true })] };

For Rollup, webpack, esbuild, Rspack, Rolldown or Farm, call the matching method — .rollup(), .webpack(), .esbuild(), .rspack(), .rolldown(), .farm() — with the same options.

Finds tagged and comment-prefixed literals. The comment form keeps editor syntax highlighting:

const vert = glsl`
  // vertex shader  ← stripped
  precision highp float;
  void main() { gl_Position = vec4(0.0); }
`;

const frag = /* wgsl */ `
  /* fragment */
  fn main() {}
`;

Options

OptionDefaultDescription
tags['glsl', 'wgsl', 'shader']Tag names / comment markers to match
scan'ast''ast' parses the file with Babel; 'loose' matches by regex — see below
include[/\.[mc]?[jt]sx?$/]Files to process — the JS/TS family Babel can parse
exclude[/node_modules/, /dist/]Files to skip — dependencies are skipped by default
outputRatiofalsePrint a bytes-saved summary after build
transformbuilt-in minifyShaderCustom minifier — (shader: string) => string
transformBatchnoneBatch minifier — (shaders: string[]) => string[] | Promise<string[]>, one call per module, all its literals at once; wins over transform when set
debugfalseLog each file's discovered literals to the console
validatefalseRe-parse each changed shader and warn on build if one stops parsing

validate: true — re-parses every shader the plugin touches, before and after, and warns (via the bundler's normal warning channel) if one stopped parsing. Needs @shaderfrog/glsl-parser (GLSL) and/or wgsl_reflect (WGSL) installed — both are optional peer dependencies, loaded lazily so builds that don't opt in never pay for them:

compressShaderLiterals.vite({ validate: true });

scan: 'loose' — for files Babel can't parse (anything that isn't plain JS/TS: Svelte components, Astro components, etc). Instead of a whole-file AST parse, it matches the same tagged/comment-prefixed literal shapes by regex. Opt in and point include at the files yourself — there's no whole-file syntax guarantee, so a match is only touched once its content also looks like a real shader:

compressShaderLiterals.vite({ scan: 'loose', include: [/\.svelte$/] });

Programmatic API — the core helpers are exported for tooling authors (validators, ESLint rules, CLIs), no plugin required:

import { extractShaderLiterals, extractShaderLiteralsLoose, minifyShader } from 'compress-shader-literals';

extractShaderLiterals('const v = glsl`void main() {}`');
// → [{ tag: 'glsl', value: 'void main() {}', start: 14, end: 30 }]

extractShaderLiteralsLoose('<script>const v = glsl`void main() {}`</script>');
// → same shape, found by regex instead of a Babel parse

minifyShader('// comment\nvoid  main() {}'); // → 'void main() {}'

Stats…

Description from the npm listing.

  • shader
  • glsl
  • wgsl
  • minify
  • minification
  • compress
  • compression
  • bundle-size
  • optimization
  • code-size
  • typescript
  • webgl
  • webgpu
  • three
  • threejs
  • ogl
  • react-three-fiber
  • shader-park
  • curtainsjs
  • shadertoy

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

compress-shader-literals weekly downloads on npm, last 90 days: 22 weekly downloads as of Oct 18, 2026, -91.1% over 90 days.compress-shader-literalsWeekly downloads on npm · Last 90 days22downloads / week-91.1% over 90 days050100150200250300Jul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18downloads / weekobservedarchived (Internet Archive)no observationsJul 22, 2026 – Oct 18, 2026 · 89 observations · Updated Oc…pluginstats.com
compress-shader-literals weekly downloads on npm, last 90 days: 22 weekly downloads as of Oct 18, 2026, -91.1% over 90 days.

7/30/90-day growth

compress-shader-literals weekly downloads growth on npm: -4.3% over 7 days, -65.6% over 30 days, -91.1% over 90 days.compress-shader-literalsWeekly downloads growth on npm22downloads / week now7-day growth-1 weekly downloads-4.3%30-day growth-42 weekly downloads-65.6%90-day growth-226 weekly downloads-91.1%Growth vs. nearest observation to each baseline date · Updated Oct 18, 2026pluginstats.com
compress-shader-literals weekly downloads growth on npm: -4.3% over 7 days, -65.6% over 30 days, -91.1% over 90 days.

Ranking history

compress-shader-literals npm ranking history: currently #1924 (by weekly downloads).compress-shader-literalsnpm ranking · by weekly downloads · Last 90 days#1924current rank#1900#1950#2000#2050#2100#2150Jul 22Aug 6Aug 21Sep 5Sep 20Oct 5Oct 20rankOct 18, 2026 – Oct 20, 2026 · 3 observations · Updated Oct 18, 2026pluginstats.com
compress-shader-literals npm ranking history: currently #1924 (by weekly downloads).

Listing placement

All npm2,320 listings · 116 pages · 1,162 shown · page 97, #8 (overall #1,928)
All npm: every listing in weekly downloads order

Listing placement

Webpack plugins251 listings · 13 pages · page 9, #9 (overall #169)
Webpack plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (122)
Recent weekly downloads observations for compress-shader-literals
Date (UTC)Weekly downloadsChange vs. previous
22+19
3-3
6-7
13-3
16-7
230
230
23-5
28+1
27+6
210
21-11
32-1
33—

Similar npm Webpack plugins plugins

All 20 compress-shader-literals alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/compress-shader-literals. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.