定制 thedava/gruntfile-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thedava/gruntfile-generator

最新稳定版本:1.0

Composer 安装命令:

composer require thedava/gruntfile-generator

包简介

A PHP based Gruntfile.js generator

README 文档

README

A PHP based Gruntfile.js generator

Build Status

Installation

php composer.phar require thedava/gruntfile-generator

Console command

php bin/gruntfile --config=your_grunt_config.php --gruntfile=Gruntfile.js

A basic configuration file

<?php

return array(
    Gruntfile::CONFIG_IMPORTS => array(
        'your-grunt-import'
    ),
    Gruntfile::CONFIG_TASKS => array(
        'your_task' => array(
            'some:target'
        )
    ),
    Gruntfile::CONFIG_TARGETS => array(
        'some' => array(
            'target' => array(
                'do' => 'something'
            )
        )
    )
);

Gruntfile generation

Add the gruntfile-generator as target to your grunt configuration for maximum efficiency. All you need is grunt-exec as import.

<?php

return array(
    Gruntfile::CONFIG_IMPORTS => array(
        'grunt-exec'
    ),
    Gruntfile::CONFIG_TASKS => array(
        'gruntfile' => array(
            'exec:gruntfile'
        )
    ),
    Gruntfile::CONFIG_TARGETS => array(
        'exec' => array(
            'gruntfile' => 'php bin/gruntfile --config=this_file.php --gruntfile=Gruntfile.js'
        )
    )
);

Run your exec target once manually on the cli and your Gruntfile will be generated. Now you can use grunt gruntfile to update your gruntfile from config

Extended config files

You can seperate your config into multiple files and build a valid gruntfile generator config using the Gruntfile class.

Let's assume that your structure looks like this:

root
|-- bin
|    |-- gruntfile
|
|-- config
|    |-- grunt.config.php
|    |-- tasks
|    |    |-- task1.config.php
|    |    |-- task2.config.php
|    |    |-- ...

Your grunt.config.php could look like this:

<?php

$configFiles = glob(__DIR__.'/tasks/*.config.php');
return Gruntfile::mergeConfigs($configFiles);

Now you can add a new file for every task/target/thing you need to do. This keeps your config simple and clean. The gruntfile generator will build one single Gruntfile at the end.

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL
  • 更新时间: 2015-09-24