1.2.2 • Published 7 months ago

esbuild-plugin-glsl v1.2.2

Weekly downloads
50
License
Zlib
Repository
github
Last release
7 months ago

esbuild-plugin-glsl

CI Version

An esbuild plugin that adds support for .frag, .vert, .glsl and .wgsl file imports with optional shader minification.

Installation

npm install esbuild-plugin-glsl

Usage

import { build } from "esbuild";
import { glsl } from "esbuild-plugin-glsl";

build({
	entryPoints: ["input.js"],
	outfile: "output.js",
	bundle: true,
	plugins: [glsl({
		minify: true
	})]
});

Options

OptionDescriptionDefault
minifyEnables or disables basic shader minification.false
resolveIncludesWhen enabled, shaders can include other shaders with the custom #include "path" directive.true

TypeScript

To make the TypeScript compiler know how to handle shader sources, add a shaders.d.ts file to your project:

declare module "*.wgsl" {
	const value: string;
	export default value;
}

declare module "*.glsl" {
	const value: string;
	export default value;
}

declare module "*.frag" {
	const value: string;
	export default value;
}

declare module "*.vert" {
	const value: string;
	export default value;
}

Contributing

Use the issue tracker to propose and discuss changes. Maintain the existing coding style. Lint and test your code.

1.2.2

7 months ago

1.2.0

1 year ago

1.2.1

1 year ago

1.1.1

1 year ago

1.1.0

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago