Package Exports
- glsl-token-extract-version
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (glsl-token-extract-version) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
glsl-token-extract-version
Gets the value of a #version
statement from a set of GLSL tokens, or returns null if no version is defined.
var tokenize = require('glsl-tokenizer')
var getVersion = require('glsl-token-extract-version')
var source = `
#version 300 es // WebGL 2
out vec4 fragColor;
void main() {
fragColor = vec4(1.0);
}
`
var version = getVersion(tokenize(source))
//=> "300 es"
Usage
version = getVersion(tokens)
For the given list of GLSL tokens, finds a preprocessor statement that matches a #version
regex. Normalizes multiple whitespace into a single space, and returns the string value, such as "300 es"
or "100"
.
If no #version
statement exists, returns null
.
License
MIT, see LICENSE.md for details.