JSPM

@undesigned/esbuild-plugin-glslify

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q48493F
  • License MIT

A plugin for ESBuild to inline and process shader files for WebGL with glslify

Package Exports

  • @undesigned/esbuild-plugin-glslify
  • @undesigned/esbuild-plugin-glslify/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@undesigned/esbuild-plugin-glslify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@undesigned/esbuild-plugin-glslify

Version

A plugin for ESBuild to inline and process shader files for WebGL with glslify

Installation

npm install -D @undesigned/esbuild-plugin-glslify

or

yarn add -D @undesigned/esbuild-plugin-glslify

Usage

import { build } from 'esbuild';
import glslify from '@undesigned/esbuild-plugin-glslify';

build({
  ...
  plugins: [
    ...

    glslify({
      /**
       * Whether to minify the code before inlining it
       *
       * Default = true
       */
      minify: false,

      /**
       * Whether to use glslify or switch it of and only
       * inline the source code
       *
       * Default = true
       */
      useGlslify: false,

      /**
       * Which file extensions to look for and use for
       * transforming and inlining
       *
       * Default = ['frag', 'vert', 'wgsl', 'vs', 'fs', 'glsl']
       */
      fileTypes: ['vert', 'frag']
    })
  ]
})

Note: all settings are optional

Declarations

Here are the file declarations for TypeScript when using the default file types:

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

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

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

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

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

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

You can put them in andy .d.ts file in your project

License

MIT