-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Move more of cmd into public API #116
Comments
It is already doable and I use minfi with gonzo, see go-gonzo/html. |
This sounds like a very specific usecase, but as omeid said, wouldn't it be fairly trivial to implement it yourself? I suppose godo already supports recursiveness and file watching, you only need to minify a single file at a time (akin to the implementation in go-gonzo/html), correct me if I'm wrong though... |
It's definitely a niche need and doable without a public command package, but you end up mostly just reinventing the wheel. The simplest way is just to copy-paste from the existing package main and then cut out all the parts you don't need, but it's a bit verbose. Nate Finch wrote a good blog post on ways of laying out your packages: https://npf.io/2016/10/reusable-commands/ . Obviously, it's your project, so just take it as a friendly suggestion. If it's interesting to you, I can work on a PR; if it's not, I can just work around it for myself. |
I don't think I will pick this up any time soon, so I'll close the issue for now. Ideally the minify cmd would be refactored at some point, but this will probably happen whenever I write a similar tool and separate the mutual code. Until then this has little priority. I've added this to #234 though. |
I use godo to manage the asset pipeline for my blog. I want to add in minify, and I can do so by just invoking minify as an external binary, but it would be slightly more efficient if I could just import it as a Go package and do something like
minifycli.Invoke("-r", "public")
. That would require changing it so that the main package is basically only getting the command line options fromos
and everything else was done in an importable package.The text was updated successfully, but these errors were encountered: