A transform stream for glslify that adds an `import` directive to your shaders.
JavaScript
Switch branches/tags
Latest commit 3302ed4 Jan 23, 2016 @hughsk hughsk 3.0.0
Permalink
Failed to load latest commit information.
test Require path resolution Jan 20, 2016
.gitignore support for glslify@2 :) Apr 20, 2015
.npmignore support for glslify@2 :) Apr 20, 2015
LICENSE.md support for glslify@2 :) Apr 20, 2015
README.md support for glslify@2 :) Apr 20, 2015
index.js Simplified path resolution Jan 20, 2016
package.json 3.0.0 Jan 23, 2016

README.md

glslify-import

A transform stream for glslify that adds an import directive to your shaders.

Usage

Given a basic shader:

// main.frag
#pragma glslify: import('./common.glsl')

void main() {
  gl_FragColor = vec4(color, 1.0);
}

You can import ./common.glsl:

// common.glsl
varying vec3 color;

And have the contents inlined into your shader:

varying vec3 color;

void main() {
  gl_FragColor = vec4(color, 1.0);
}

You can also use glslify pragmas and the like from your imported files as well. Useful for the cases when you want to include a common "base" set of definitions in your shaders without losing the niceties of glslify.