0.0.2 • Published 6 months ago
esbuild-lygia-plugin v0.0.2
lygia-loader
A build-time resolver for the Lygia shader library that handles GLSL includes for esbuild.
Features
- Resolves Lygia includes at build time
- Caches downloaded files locally
- Supports local file includes with recursive resolution
- Built for esbuild
- Live reload support for development
Installation
npm install lygia-loader
Usage
Add to your esbuild configuration:
import lygiaPlugin from 'lygia-loader/plugin';
export default {
plugins: [lygiaPlugin()],
loader: {
'.glsl': 'text',
}
}
For development with live reload:
import liveReload from 'esbuild-live-reload';
export default {
plugins: [
lygiaPlugin(),
liveReload(['src/**/*', 'shaders/**/*'])
]
}
Using in Shaders
You can include both Lygia modules and local files in your shaders:
// Include from Lygia
#include "lygia/math/const.glsl"
#include "lygia/space/ratio.glsl"
// Include local files
#include "./local/utils.glsl"
License
MIT