Revamp the CLI bin and add documentation to the readme #388
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm using this package for a few different projects and I didn't even realize that there was an included CLI tool.
However, I needed the CLI tool to actually create the files rather than just echo the minified contents to
STDOUT, so this led me to revamp the CLI tool.This PR does a few things:
minifycssandminifyjscommands into a singleminifycommand (A breaking change for anyone currently using the CLI tool).--ouputor-ooption to have the minified contents written to a file (And if no output is defined, it'll echo the minified contents toSTDOUTjust like before).-o "/path/to/minified/*.min.js")--import-ext,--gzip, and--max-import-sizeoptions to be able to use those features with the CLI tool.helpoption to the CLI tool.So now, you can do something like this:
and you'll end up with a
test.jsandtest.cssfile.This will come in handy as a dev tool for projects. For example, I could add a build script to the
composer.jsonfile of my package:{ "scripts": { "build": "vendor/bin/minify source1.js source2.js -o build.min.js" }, "require-dev": { "matthiasmullie/minify": "^1.3.63" } }What's also nice about this is that other than swapping out the
minifycssandminifyjscommands forminifyit'll still function exactly the same as before unless you specifically decide to use some of the newly added options.