GithubHelp home page GithubHelp logo

isabella232 / glsl-min-stream Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stackgl/glsl-min-stream

0.0 0.0 0.0 60 KB

through stream that transforms glsl-parser AST nodes and rewrites variables into shorter forms

JavaScript 68.94% GLSL 31.06%

glsl-min-stream's Introduction

NPM npm npm Build Status Coverage Status

glsl-min-stream

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

var tokenizer = require('glsl-tokenizer/stream')
  , 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).

Testing

Run npm test to run tests


When adding a code change that differs the output, make sure to run tap with snapshots by running npm run test -- --snapshot. This will regenerate the tap-snapshot files. Make sure to commit those along with other code and test changes.

License

MIT

glsl-min-stream's People

Contributors

axion014 avatar chrisdickinson avatar dhritzkiv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.