|
@@ -15,20 +15,20 @@ class Min extends Command
|
|
* 路径和文件名配置
|
|
* 路径和文件名配置
|
|
*/
|
|
*/
|
|
protected $options = [
|
|
protected $options = [
|
|
- 'cssBaseUrl' => 'public/assets/css/',
|
|
|
|
|
|
+ 'cssBaseUrl' => 'public/assets/css/',
|
|
'cssBaseName' => '{module}',
|
|
'cssBaseName' => '{module}',
|
|
- 'jsBaseUrl' => 'public/assets/js/',
|
|
|
|
- 'jsBaseName' => 'require-{module}',
|
|
|
|
|
|
+ 'jsBaseUrl' => 'public/assets/js/',
|
|
|
|
+ 'jsBaseName' => 'require-{module}',
|
|
];
|
|
];
|
|
|
|
|
|
protected function configure()
|
|
protected function configure()
|
|
{
|
|
{
|
|
$this
|
|
$this
|
|
- ->setName('min')
|
|
|
|
- ->addOption('module', 'm', Option::VALUE_REQUIRED, 'module name(frontend or backend),use \'all\' when build all modules', null)
|
|
|
|
- ->addOption('resource', 'r', Option::VALUE_REQUIRED, 'resource name(js or css),use \'all\' when build all resources', null)
|
|
|
|
- ->addOption('optimize', 'o', Option::VALUE_OPTIONAL, 'optimize type(uglify|closure|none)', 'none')
|
|
|
|
- ->setDescription('Compress js and css file');
|
|
|
|
|
|
+ ->setName('min')
|
|
|
|
+ ->addOption('module', 'm', Option::VALUE_REQUIRED, 'module name(frontend or backend),use \'all\' when build all modules', null)
|
|
|
|
+ ->addOption('resource', 'r', Option::VALUE_REQUIRED, 'resource name(js or css),use \'all\' when build all resources', null)
|
|
|
|
+ ->addOption('optimize', 'o', Option::VALUE_OPTIONAL, 'optimize type(uglify|closure|none)', 'none')
|
|
|
|
+ ->setDescription('Compress js and css file');
|
|
}
|
|
}
|
|
|
|
|
|
protected function execute(Input $input, Output $output)
|
|
protected function execute(Input $input, Output $output)
|
|
@@ -79,15 +79,15 @@ class Min extends Command
|
|
foreach ($moduleArr as $mod) {
|
|
foreach ($moduleArr as $mod) {
|
|
foreach ($resourceArr as $res) {
|
|
foreach ($resourceArr as $res) {
|
|
$data = [
|
|
$data = [
|
|
- 'publicPath' => $publicPath,
|
|
|
|
- 'jsBaseName' => str_replace('{module}', $mod, $this->options['jsBaseName']),
|
|
|
|
- 'jsBaseUrl' => $this->options['jsBaseUrl'],
|
|
|
|
|
|
+ 'publicPath' => $publicPath,
|
|
|
|
+ 'jsBaseName' => str_replace('{module}', $mod, $this->options['jsBaseName']),
|
|
|
|
+ 'jsBaseUrl' => $this->options['jsBaseUrl'],
|
|
'cssBaseName' => str_replace('{module}', $mod, $this->options['cssBaseName']),
|
|
'cssBaseName' => str_replace('{module}', $mod, $this->options['cssBaseName']),
|
|
- 'cssBaseUrl' => $this->options['cssBaseUrl'],
|
|
|
|
- 'jsBasePath' => str_replace(DS, '/', ROOT_PATH . $this->options['jsBaseUrl']),
|
|
|
|
|
|
+ 'cssBaseUrl' => $this->options['cssBaseUrl'],
|
|
|
|
+ 'jsBasePath' => str_replace(DS, '/', ROOT_PATH . $this->options['jsBaseUrl']),
|
|
'cssBasePath' => str_replace(DS, '/', ROOT_PATH . $this->options['cssBaseUrl']),
|
|
'cssBasePath' => str_replace(DS, '/', ROOT_PATH . $this->options['cssBaseUrl']),
|
|
- 'optimize' => $optimize,
|
|
|
|
- 'ds' => DS,
|
|
|
|
|
|
+ 'optimize' => $optimize,
|
|
|
|
+ 'ds' => DS,
|
|
];
|
|
];
|
|
|
|
|
|
//源文件
|
|
//源文件
|