03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Deployment 95<br />

63 InputArgument::REQUIRED,<br />

64 "Names of input files."<br />

65 ]<br />

66 ];<br />

67 }<br />

68<br />

69 protected function getOptions()<br />

70 {<br />

71 return [<br />

72 [<br />

73 "output",<br />

74 null,<br />

75 InputOption::VALUE_OPTIONAL,<br />

76 "Name of output file.",<br />

77 null<br />

78 ]<br />

79 ];<br />

80 }<br />

81 }<br />

.<br />

This file should be saved as app/commands/AssetMinifyCommand.php.<br />

The minify command accepts two arguments — the type of assets (either css or js) and the commadelimited<br />

list of asset files to minify. Like the combine command; it will output to console by default,<br />

unless the —output option is specified.<br />

.<br />

You can learn more about Assetic-Minifier at: https://github.com/toopay/assetic-minifier<br />

Building Assets<br />

Commands that accept inputs and outputs are really useful for the combining and minifying asset<br />

files, but it’s a pain to have to specify inputs and outputs each time (especially when we have gone to<br />

the effort of defining asset lists in configuration files). For this purpose; we need a command which<br />

will combine and minify all the asset files appropriately.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!