/ piacw.com / dev / final / node_modules / glsl-token-whitespace-trim /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]fixtures/2 years ago -  
[TXT]LICENSE.md2 years ago1.1K0fb859dc fixed mobile overflwo options [كارل مبارك]
[TXT]README.md2 years ago1.3K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]index.js2 years ago1.5K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]package.json2 years ago1.8K0fb859dc fixed mobile overflwo options [كارل مبارك]
README.md

glsl-token-whitespace-trim

stable

Trim the whitespace within an array of GLSL tokens provided by glsl-tokenizer. Useful for minimising shader source size, especially after heavy processing steps such as seen in glslify or as part of a GLSL minifier.

Usage

NPM

trim(tokens, [all])

Trims the whitespace in an array of GLSL tokens. By default, this will trim repeated to newlines such that no more than two newlines will appear in a row.

If you're more concerned about size than aesthetics, you can pass true as the second argument to remove all extraneous whitespace (more or less).

const tokenize = require('glsl-tokenizer')
const string = require('glsl-token-string')
const trim = require('glsl-token-whitespace-trim')
const fs = require('fs')

const src = fs.readFileSync('shader.glsl', 'utf8')
const tokens = tokenize(src)

trim(tokens, true)

const trimmed = string(tokens)

License

MIT, see LICENSE.md for details.

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80