glslify / glslify/glslify-bundle

Comments should be stripped from bundles

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10
Forks
4
PR merge metrics
No merged PRs in 30d

Description

When bundling with glslify, comments are not removed from the final source string. I'm trying to the output to be as packed as possible. I am currently using a custom function in my own fork of glslify-bundle that does the trick:

```
function strip_comments(tokens) {
for (var i = 1; i < tokens.length; i++) {
var token = tokens[i]
if (token.type == 'block-comment' || token.type == 'line-comment') {
tokens.splice(i--, 1);
}
}

return tokens
}
```

then in the Bundle function I just do:

```
this.src = string(clean(strip_comments(trim(tokenize(this.src), true))))
```

Would you accept a PR for this change?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.