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:
minifycss
andminifyjs
commands into a singleminify
command (A breaking change for anyone currently using the CLI tool).--ouput
or-o
option to have the minified contents written to a file (And if no output is defined, it'll echo the minified contents toSTDOUT
just like before).-o "/path/to/minified/*.min.js"
)--import-ext
,--gzip
, and--max-import-size
options to be able to use those features with the CLI tool.help
option to the CLI tool.So now, you can do something like this:
and you'll end up with a
test.js
andtest.css
file.This will come in handy as a dev tool for projects. For example, I could add a build script to the
composer.json
file of my package:What's also nice about this is that other than swapping out the
minifycss
andminifyjs
commands forminify
it'll still function exactly the same as before unless you specifically decide to use some of the newly added options.