luma.gl/dev-modules/babel-plugin-inline-webgl-constants
2020-04-16 10:30:22 -04:00
..
2019-07-18 12:09:27 -07:00
2020-04-16 10:30:22 -04:00

babel-plugin-inline-webgl-constants

Replaces gl.<constant> or GL.<constant> references with the corresponding OpenGL constant value.

When used on luma.gl applications, also removes any import of the GL namespace.

Example

in

const max = gl.MAX_VERTEX_ATTRIBS;

out

const max = 34921;

in

import GL from '@luma.gl/constants';
...
const max = GL.MAX_VERTEX_ATTRIBS;

out

...
const max = 34921;

Installation

$ npm install --save-dev babel-plugin-inline-webgl-constants

Usage

.babelrc

{
  "plugins": ["inline-webgl-constants"]
}

Via CLI

$ babel --plugins inline-webgl-constants script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["inline-webgl-constants"]
});