-
-
Notifications
You must be signed in to change notification settings - Fork 224
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
Format instead of minify #458
Comments
That is a little easier than minifying, unless you'd like to infer meaningful variable names (I'm thinking of training a neural net for that). I mean, the parser is already there! The truth is I have limited time, and apart from SiteGround's support for maintaining this library, nobody really appreciates the immense work that goes into these projects. I'd say 80% of the interactions I have with people is because something doesn't work or they want something from me (no jab at you), which aren't very positive interactions to be honest (some people even get mad). Then there is competition with other packages that try to make you irrelevant...all in all not a great deal to be completely frank. The projects I do in real-life do have a significant impact, with palpable results and visibly happy faces, and above all I get paid. So besides maintaining this library and slightly improving it bit by bit, I'm not very motivated to continue development on new stuff. Sorry for the undirected rant... |
I'm mostly looking to see if it is feasible to build on minify to create a Go native version of prettier.io Not a feature request at this point, I may be open to contributing such functionality. Wondering if there might be a way to use rules that are defined outside of the program itself |
Absolutely you can, it's actually pretty easy. You can use the |
@verdverm did you ever make any progress on this? I was looking to format HTML (fix indentation, remove excessive whitespace, etc) and am already using github.com/tdewolff/minify and github.com/tdewolff/parse so figured it would be nice to stick with a solution that leverages these tools. I did find 2 other projects that are implementing something similar in case it's helpful for anyone (I haven't tried them yet): I'm sorry to hear the frustrations with supporting these projects @tdewolff. Open source is the best, but is often thankless. I just wanted to drop a quick note saying how much I appreciate your work, these projects are immensely helpful for my own side projects. Thank you for pouring so much effort into these and sharing them with all of us! |
@jimafisk I went another path
You can run https://docs.hofstadter.io/code-generation/formatting/ If you want custom formatters or rules, that is possible as well |
There is a JS formatter already, the HTML/XML/SVG formatters are in the pipeline (specifically, building an AST from their sources which allows creating a formatter), and an improved CSS parser as well (to support rule nesting). I will re-open this issue to keep you updated! This will probably happen in a few months time though. Thanks for the interest and the kind words, that is really appreciated. Great to hear that these libraries are so useful to you! |
Thank you for the quick replies @verdverm and @tdewolff!
That's amazing 🙌 this is something I was hoping for as well. I'd love to see an example of this if it's something that's easy to point to or demonstrate.
This is great news, I appreciate you keeping us in the loop!
Totally fine by me, I'm excited it's on the roadmap! Thanks so much! |
Excellent! To pretty-print JS you can do something along these lines:
See the documentation for other options. There is an |
Thank you for the pretty-print JS example @tdewolff, that was so helpful! I just tried it out in my project and it worked great! |
Awesome to hear, and thanks so much for sponsoring the project!! |
how realistic or feasible would it be to leverage minify for code formatting rather than minifying?
The text was updated successfully, but these errors were encountered: