CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.
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:
Combines the minifycss and minifyjs commands into a single minify command (A breaking change for anyone currently using the CLI tool).
Adds the ability to define an --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 to STDOUT just like before).
Adds the ability for multiple input files to be minified into each of their own output files (ex. -o "/path/to/minified/*.min.js")
Adds the --import-ext, --gzip, and --max-import-size options to be able to use those features with the CLI tool.
Adds the ability to pass multiple input files to be combined and minified together.
Adds documentation about the CLI tool to the readme.
What's also nice about this is that other than swapping out the minifycss and minifyjs commands for minify it'll still function exactly the same as before unless you specifically decide to use some of the newly added options.
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.