rollup-plugin-glslify
Version:
Import GLSL strings with glslify
81 lines (57 loc) • 1.57 kB
Markdown
[![NPM Package][npm]][npm-url]
[![NPM Package][lgtm]][lgtm-url]
Import GLSL strings with [glslify](https://github.com/glslify/glslify) (a node.js-style module system for GLSL).
```js
import frag from './shaders/frag.glsl';
console.log(frag);
```
```sh
npm i -D rollup-plugin-glslify
yarn add -D rollup-plugin-glslify
```
```js
// rollup.config.js
import glslify from 'rollup-plugin-glslify';
export default {
// ...
plugins: [
glslify()
]
};
```
```js
glslify(options)
```
```js
{
// Default
include: [
'**/*.vs',
'**/*.fs',
'**/*.vert',
'**/*.frag',
'**/*.glsl'
],
// Undefined by default
exclude: 'node_modules/**',
// Enabled by default
compress: true
// The compress option also accepts a function with its first argument
// being the string containing the glslified shader code.
// The function is expected to return a string (or object) - the compressed shader
}
```
[](https://github.com/glslify/glslify#var-src--glslcompilesrc-opts)
* [Releases](https://github.com/glslify/rollup-plugin-glslify/releases)
Released under the [MIT license](LICENSE).
[]: https://img.shields.io/npm/v/rollup-plugin-glslify.svg
[]: https://www.npmjs.com/package/rollup-plugin-glslify
[]: https://img.shields.io/lgtm/alerts/github/glslify/rollup-plugin-glslify.svg
[]: https://lgtm.com/projects/g/glslify/rollup-plugin-glslify