An open API service indexing awesome lists of open source software.

https://github.com/actnwit/esbuild-plugin-shaderity


https://github.com/actnwit/esbuild-plugin-shaderity

Last synced: 8 days ago
JSON representation

Awesome Lists containing this project

README

          

# esbuild-plugin-shaderity

## What's this?

A ESBuild plugin for [shaderity](https://github.com/actnwit/shaderity), which is a web-oriented shader utility.

## Config

Write a node program file as following:

```javascript
// build.js
const esbuild = require('esbuild');
const shaderity = require('esbuild-plugin-shaderity');
esbuild.build({
entryPoints: ['./src/index.js'],
bundle: true,
outdir: 'dist',
plugins: [
shaderity(),
]
});
```

## Code Sample

```glsl
// simple.frag
precision mediump float;
in vec4 vColor;

void main() {
gl_FlagColor = vColor;
}
```

```javascript
// ./src/index.js
import simpleFragmentShader from './simple.frag';

console.log(simpleFragmentShader);
```

## Build

Run the written build.js with node.

```bash
$ node build.js
```

The built file must be output to the ./dist directory.