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

Option to minimize output? #25

Open
max-degterev opened this issue Jan 20, 2017 · 4 comments
Open

Option to minimize output? #25

max-degterev opened this issue Jan 20, 2017 · 4 comments

Comments

@max-degterev
Copy link

Would be nice to have an option to remove unnecessary whitespace in stringified functions

@ericf
Copy link
Collaborator

ericf commented Jan 20, 2017

Have you tried feeding the output of module into a minifier? I would suggesting looking at babili as it supports ES6+ syntax while Uglify doesn't.

@max-degterev
Copy link
Author

it would work, but would create additional overhead parsing surrounding JSON structures, best place to put minifier is here: https://github.com/yahoo/serialize-javascript/blob/master/index.js#L101

@ericf
Copy link
Collaborator

ericf commented Jan 20, 2017

I would prefer to keep this package simple and not add a minifier as a runtime dependency. Have you thought about minifying your functions/code at build time that will be serialized? If you pre-minify the function, it will offer the best perf as then it wouldn't have to happen on every single serialize() call (or after every call).

@GitBruno
Copy link
Contributor

Could you add another option?

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

3 participants