Skip to content

Commit 894e308

Browse files
committed
Apply changesets and update CHANGELOG
1 parent 709f2d7 commit 894e308

File tree

1 file changed

+57
-11
lines changed

1 file changed

+57
-11
lines changed

lib/README.md

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,107 @@
22

33
[![test](https://github.com/react18-tools/esbuild-plugin-webgl/actions/workflows/test.yml/badge.svg)](https://github.com/react18-tools/esbuild-plugin-webgl/actions/workflows/test.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/c2532ae011e53b1bf011/maintainability)](https://codeclimate.com/github/react18-tools/esbuild-plugin-webgl/maintainability) [![codecov](https://codecov.io/gh/react18-tools/esbuild-plugin-webgl/graph/badge.svg)](https://codecov.io/gh/react18-tools/esbuild-plugin-webgl) [![Version](https://img.shields.io/npm/v/esbuild-plugin-webgl.svg?colorB=green)](https://www.npmjs.com/package/esbuild-plugin-webgl) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/esbuild-plugin-webgl.svg)](https://www.npmjs.com/package/esbuild-plugin-webgl) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/esbuild-plugin-webgl) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/from-referrer/)
44

5-
ESBuild plugin to load webGL shaders from `.glsl` files.
5+
ESBuild plugin to load WebGL shaders from `.glsl` files.
66

77
> <img src="https://github.com/react18-tools/esbuild-plugin-webgl/blob/main/popper.png?raw=true" style="height: 20px"/> Please consider starring [this repository](https://github.com/react18-tools/esbuild-plugin-webgl) and sharing it with your friends.
88
9+
## Overview
10+
11+
This ESBuild plugin streamlines the process of loading WebGL shaders in your JavaScript or TypeScript projects. By allowing you to import GLSL shader files directly into your project, it ensures a seamless development experience for WebGL applications. This approach promotes better separation of concerns by eliminating the need to hard code GLSL shader code into your JS or TS files. Additionally, it compresses the shader code, helping you to deliver a smaller minified bundle for your library.
12+
13+
### Key Features
14+
15+
- **Easy Integration**: Easily integrate GLSL shaders into your ESBuild workflow.
16+
- **TypeScript Support**: Full support for TypeScript, making it easier to work with shaders in a type-safe environment.
17+
- **Lightweight**: Minimal footprint, ensuring your build times remain fast.
18+
- **Flexible Configuration**: Compatible with various build tools and configurations, including `tsup` and standard `esbuild` setups.
19+
920
## Getting Started
1021

22+
Follow these steps to get started with the ESBuild Plugin WebGL:
23+
1124
### Installation
1225

26+
You can install the plugin using your preferred package manager:
27+
28+
Using `pnpm`:
29+
1330
```bash
1431
$ pnpm add esbuild-plugin-webgl
1532
```
1633

17-
**_or_**
34+
Using `npm`:
1835

1936
```bash
2037
$ npm install esbuild-plugin-webgl
2138
```
2239

23-
**_or_**
40+
Using `yarn`:
2441

2542
```bash
2643
$ yarn add esbuild-plugin-webgl
2744
```
2845

29-
> If you are using `monorepo` or `workspaces`, you can install this plugin to the root using `-w` or to a specific workspace using `--filter your-package` or `--scope your-package` for `pnpm` or `yarn` workspaces, respectively.
46+
> **Note**: If you are using a monorepo or workspaces, you can install this plugin at the root using the `-w` option or to a specific workspace using `--filter your-package` or `--scope your-package` for `pnpm` or `yarn` workspaces, respectively.
47+
48+
## Usage
49+
50+
### With `tsup`
3051

31-
## Use with `tsup`
52+
To use the plugin with `tsup`, add it to your `tsup.config.ts` or `tsup.config.js` file:
3253

3354
```ts
3455
// tsup.config.ts or tsup.config.js
3556
import { defineConfig } from "tsup";
3657
import { webglPlugin } from "esbuild-plugin-webgl";
3758

38-
export default defineConfig(options => ({
59+
export default defineConfig((options) => ({
3960
...
40-
esbuildPlugins:[webglPlugin()]
61+
esbuildPlugins: [webglPlugin()],
4162
}));
4263
```
4364

44-
## Use with `esbuild`
65+
### With `esbuild`
66+
67+
To use the plugin directly with `esbuild`, include it in your build configuration:
4568

4669
```ts
4770
import { webglPlugin } from "esbuild-plugin-webgl";
4871

4972
esbuild.build({
50-
...
51-
plugins: [webglPlugin()],
73+
...
74+
plugins: [webglPlugin()],
5275
});
5376
```
5477

78+
### Example Usage
79+
80+
Here's a quick example of how you can import and use a GLSL shader in your project:
81+
82+
```ts
83+
import vertexShader from "./shaders/vertex.glsl";
84+
import fragmentShader from "./shaders/fragment.glsl";
85+
86+
// Initialize WebGL context and use the imported shaders
87+
const gl = canvas.getContext("webgl");
88+
const vertexShader = gl.createShader(gl.VERTEX_SHADER);
89+
gl.shaderSource(vertexShader, vertexShaderSource);
90+
gl.compileShader(vertexShader);
91+
92+
const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
93+
gl.shaderSource(fragmentShader, fragmentShaderSource);
94+
gl.compileShader(fragmentShader);
95+
```
96+
5597
![Alt](https://repobeats.axiom.co/api/embed/a1fadcf8aa3054acff5d430c970af9e61254da5c.svg "Repobeats analytics image")
5698

99+
## Contributing
100+
101+
Contributions are welcome! If you find a bug or have a feature request, please open an issue. For major changes, please open a discussion first to discuss what you would like to change.
102+
57103
## License
58104

59-
This library is licensed under the MPL-2.0 open-source license.
105+
This library is licensed under the MPL-2.0 open-source license. See the [LICENSE](LICENSE) file for more details.
60106

61107
> <img src="https://github.com/react18-tools/esbuild-plugin-webgl/blob/main/popper.png?raw=true" style="height: 20px"/> Please consider enrolling in [our courses](https://mayank-chaudhari.vercel.app/courses) or [sponsoring](https://github.com/sponsors/mayank1513) our work.
62108

0 commit comments

Comments
 (0)