@littlstar/babel-plugin-glslify
glslify as a babel transform
Last updated 3 years ago by littlstar .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @littlstar/babel-plugin-glslify 
SYNC missed versions from official npm registry.

babel-plugin-glslify

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 babel-plugin-glslify

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"]
    }
  ]]
}

License

(c) 2016 MIT License

Current Tags

  • 2.0.0                                ...           latest (3 years ago)

1 Versions

  • 2.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 4
Dependencies (3)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |