Socket
Book a DemoInstallSign in
Socket

glslify-babel

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glslify-babel

glslify as a babel transform

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

glslify-babel

A babel transform for glslify.

Example

This module works the same as the browserify transform in glslify, except that it is compatible with babel. It also supports ES6 syntax and some more advanced features like tagged strings. For example, you can write something like this,

import glsl from glslify;

const myFragShader = glsl`
#pragma glslify: noise = require(glsl-noise/simplex/2d)

void main () {
  float brightness = noise(gl_FragCoord.xy);
  gl_FragColor = vec4(vec3(brightness), 1.);
}
`;

Configuration

To install this module, you need to install glslify as well:

npm i -S glslify glslify-babel

Then you need to configure babel to run the transform. For example, if you were using browserify with babelify to run babel you would add the following to your package.json to run glslify:

// ... in your package.json
"browserify": {
  "transform": [[
    "babelify", {
      "presets": ["es2015"],
      "plugins": ["glslify-babel"]
    }
  ]]
}

License

(c) 2016 MIT License

Keywords

babel

FAQs

Package last updated on 29 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts