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

Add a JS minifier Step #37

Closed
pydsigner opened this issue Aug 11, 2023 · 5 comments · Fixed by #56
Closed

Add a JS minifier Step #37

pydsigner opened this issue Aug 11, 2023 · 5 comments · Fixed by #56
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@pydsigner
Copy link
Owner

Right now we don't have any minifiers for JavaScript. minify-html comes with minify-js, but minify-js is known to have correctness issues: https://github.com/privatenumber/minification-benchmarks.

@pydsigner
Copy link
Owner Author

pydsigner commented Aug 11, 2023

https://github.com/tdewolff/minify is built in Go but comes with Python bindings, but lacks wheels in its CI. Best play may be to make a pull request to add wheels, since the repository is actively maintained.

@pydsigner
Copy link
Owner Author

Another option could be to make PyO3 bindings to https://github.com/swc-project/swc; however, this project is much broader than our need, and could be a huge challenge to wrap for our needs.

@pydsigner pydsigner added this to the 1.0.0 milestone Aug 11, 2023
@pydsigner pydsigner added enhancement New feature or request blocked This issue or pull request cannot be completed until something outside this project occurs labels Aug 12, 2023
@pydsigner
Copy link
Owner Author

See tdewolff/minify#599 and tdewolff/minify#600. Looks like Golang is very difficult to bind to Python, so may consider working on swc bindings with maturin.

@pydsigner
Copy link
Owner Author

SWC is about 10x slower than tdewolff-minify and produces about 1% smaller output.

@pydsigner
Copy link
Owner Author

We should be able to move forward with tdewolff-minify; though wheels won't be available for every platform, the most important by far will be covered along with several others. Mac users may need to use Docker or a VM as a workaround.

@pydsigner pydsigner removed the blocked This issue or pull request cannot be completed until something outside this project occurs label Oct 31, 2023
@pydsigner pydsigner self-assigned this Oct 31, 2023
pydsigner added a commit that referenced this issue Nov 4, 2023
Add AssetMinifierStep, using tdewolff-minify (#37)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant