1.3.0 • Published 5 months ago

rollup-shader-chunks v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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

ActionCommandDescription
lintnpm run lintRun static code analysis
formatnpm run formatCheck source file formatting
format-fixnpm run format-fixFormat source files

Tools

ToolReference
Node.jshttps://nodejs.org
rollup.jshttps://rollupjs.org
ESLinthttps://eslint.org
Prettierhttps://prettier.io
EditorConfighttps://editorconfig.org

References

WebsiteReference
WebGL2https://www.khronos.org/webgl/

License

This project is released under the MIT License.

1.3.0

5 months ago

1.2.1

6 months ago

1.2.0

6 months ago

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.1

7 months ago

1.0.0

7 months ago