rollup-shader-chunks

1.3.0 • Public • Published

rollup-shader-chunks

Rollup plugin for optimising inline GLSL shaders.

NPM version License CI

Example

This plugin processes template literals marked with a syntax highlighting and embedded script editing hint.

// shaders.js
export const vertex = /* glsl */ `
  void main() {
      gl_Position = mvp * vec4( position, 1.0 );
  }
`;

Install

npm i rollup-shader-chunks --save-dev

Usage

// rollup.config.js

import { shaderChunks } from 'rollup-shader-chunks';

export default {
  input: 'src/index.js',
  plugins: [
    //... other plugins, preprocessing
    shaderChunks()
    //... other plugins, terser, etc
  ]
  //...other options
};

Defaults

shaderChunks({
  include: [
    // Glob pattern, or array of glob patterns to include
    '**/*.js'
  ],
  exclude: undefined, // Glob pattern, or array of glob patterns to ignore
  enabled: true // Enable or disable the processing of files
});

Scripts

Action Command Description
lint npm run lint Run static code analysis
format npm run format Check source file formatting
format-fix npm run format-fix Format source files

Tools

Tool Reference
Node.js https://nodejs.org
rollup.js https://rollupjs.org
ESLint https://eslint.org
Prettier https://prettier.io
EditorConfig https://editorconfig.org

References

Website Reference
WebGL2 https://www.khronos.org/webgl/

License

This project is released under the MIT License.

Package Sidebar

Install

npm i rollup-shader-chunks

Weekly Downloads

9

Version

1.3.0

License

MIT

Unpacked Size

6.44 kB

Total Files

4

Last publish

Collaborators

  • epreston