Socket
Book a DemoInstallSign in
Socket

babel-plugin-remove-glsl-comments

Package Overview
Dependencies
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-remove-glsl-comments

Babel plugin for removing glsl comments

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
70
-28.57%
Maintainers
5
Weekly downloads
 
Created
Source

babel-plugin-remove-glsl-comments

Remove comments in glsl shader source.

Example

in

// vertex.glsl.js
const vs = `
/* Projection uniforms */
uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;
uniform mat3 modelMatrix;

/* Attributes */
attribute vec3 positions;
attribute vec3 instancePositions;

main() {
  vec4 worldPosition = vec4(instancePositions + modelMatrix * positions, 1.); // resolved position of the current vertex
  gl_Position = projectionMatrix * viewMatrix * worldPosition;
}
`;

out

// vertex.glsl.js
const vs = '\nuniform mat4 viewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat3 modelMatrix;\n\nattribute vec3 positions;\nattribute vec3 instancePositions;\n\nmain() {\n  vec4 worldPosition = vec4(instancePositions + modelMatrix * positions, 1.);\n  gl_Position = projectionMatrix * viewMatrix * worldPosition;\n}\n';

Note: for safety, this plugin does not remove dynamically generated comments, e.g.

const vs = `/* MODULE ${name} STARTS */`;
const vs = `// END OF ${name}`;

Installation

$ npm install --save-dev babel-plugin-remove-glsl-comments

Usage

.babelrc

{
  "plugins": ["remove-glsl-comments"]
}

With options:

{
  "plugins": [["remove-glsl-comments", {
    "patterns": ["*.glsl.js"]
  }]]
}

Via CLI

$ babel --plugins remove-glsl-comments script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["remove-glsl-comments"]
});

Options

patterns (Array)

An array of glob expressions that specify which files to apply this plugin to. Default ['*.js'].

Keywords

babel-plugin

FAQs

Package last updated on 04 Feb 2019

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.