esbuild-lygia-plugin

0.0.2 • Public • Published

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

/esbuild-lygia-plugin/

    Package Sidebar

    Install

    npm i esbuild-lygia-plugin

    Weekly Downloads

    0

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    4.31 kB

    Total Files

    3

    Last publish

    Collaborators

    • dudnik