babel-plugin-inline-webgl-constants

1.0.3 • Public • Published

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

Via .babelrc (Recommended)

.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']
});

Package Sidebar

Install

npm i babel-plugin-inline-webgl-constants

Weekly Downloads

12

Version

1.0.3

License

MIT

Unpacked Size

3.68 kB

Total Files

3

Last publish

Collaborators

  • donmccurdy
  • felixpalmer
  • pessimistress
  • ibgreen
  • dryabinin
  • belom88