开发者社区> 镜像站> NPM> glsl-min-stream
glsl-min-stream
through stream that transforms glsl-parser AST nodes and rewrites variables into shorter forms
Last updated 6 years ago by chrisdickinson .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install glsl-min-stream 
SYNC missed versions from official npm registry.

glsl-min-stream

Transform glsl-parser AST nodes on-the-fly by renaming variables into shorter forms.

var tokenizer = require('glsl-tokenizer')
  , parser = require('glsl-parser')
  , deparser = require('glsl-deparser')
  , minify = require('./index')

process.stdin
  .pipe(tokenizer())
  .pipe(parser())
  .pipe(minify())           // <-- the minifier
  .pipe(deparser(false))    // <-- "false" == no unnecessary whitespace, please.
  .pipe(process.stdout)

process.stdin.resume()

API

minifier = require('glsl-minifier')([safe_word_list], should_mutate_storages) -> minifier stream

Create a through stream that rewrites incoming declared variables.

  • safe_word_list defaults to ["main"] so that the main function is not overridden.
  • should_mutate_storages, a boolean defaulted to false, determines whether the minifier should attempt to rewrite variables declared as varying, attribute, or uniform (usually you do not want to do this, as the client program is expecting specific variable names).

License

MIT

Current Tags

  • 1.0.0                                ...           latest (6 years ago)

4 Versions

  • 1.0.0                                ...           6 years ago
  • 0.0.2                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
  • 0.0.0                                ...           8 years ago
Downloads
Today 0
This Week 12
This Month 10
Last Day 8
Last Week 1
Last Month 34
Dependencies (3)
Dev Dependencies (0)
None