@plutotcool/rollup-plugin-glsl
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

rollup-plugin-glsl

test build release version types

Rollup plugin that allows imports of glsl files. Resolves #include directives and minifies glsl code using @plutotcool/glsl-bundler.

Live demo

Install

yarn add @plutotcool/rollup-plugin-glsl --dev
// rollup.config.js

import { glsl } from '@plutotcool/rollup-plugin-glsl'

export default {
  plugins: [
    glsl({ /* options */ })
  ]
}

Options

interface GLSLParameters {
  /**
   * Patterns of files that must be transformed by the plugin.
   * 
   * Default: /\.(?:glsl|frag|vert)$/
   */
  include?: (string | RegExp)[] | string | RegExp | null

  /**
   * Patterns of files that must not be transformed by the plugin.
   * 
   * Default: null
   */
  exclude?: (string | RegExp)[] | string | RegExp | null

  /**
   * Alternative custom filter function that determines if a file should be
   * transformed by the plugin. If specified, the include and exclude parameters
   * are ignored.
   * 
   * Default: filter function created from include and exclude parameters
   */
  filter?: (id: string) => boolean
  
  /**
   * Enable #include directives
   *
   * Default: true
   */
  loader?: boolean

  /**
   * Enable minifier or specify custom minify parameters
   *
   * Default: true
   */
  minifier?: boolean | {
    renameFunctions?: boolean
    renameVariables?: boolean
    renameDefines?: boolean
    renameStructs?: boolean
    trimComments?: boolean
    trimSpaces?: boolean
    trimZeros?: boolean
  }

  /**
   * Additional transform functions to apply to glsl code
   */
  transforms?: ((source: string) => Promise<string> | string)[]
}

Usage

Get more informations from @plutotcool/glsl-bundler package.

Readme

Keywords

none

Package Sidebar

Install

npm i @plutotcool/rollup-plugin-glsl

Weekly Downloads

4

Version

1.2.1

License

MIT

Unpacked Size

9.77 kB

Total Files

9

Last publish

Collaborators

  • plutotcool-release-bot
  • bastienrobert
  • juliendargelos