Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments should be stripped from bundles #4

Open
mikecao opened this issue Aug 29, 2016 · 0 comments
Open

Comments should be stripped from bundles #4

mikecao opened this issue Aug 29, 2016 · 0 comments

Comments

@mikecao
Copy link

mikecao commented Aug 29, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant