2017 © Pedro Peláez
 

library gruntfile-generator

A PHP based Gruntfile.js generator

image

thedava/gruntfile-generator

A PHP based Gruntfile.js generator

  • Saturday, October 17, 2015
  • by dava
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

gruntfile-generator

A PHP based Gruntfile.js generator, (*1)

Build Status, (*2)

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., (*3)

<?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, (*4)

Extended config files

You can seperate your config into multiple files and build a valid gruntfile generator config using the Gruntfile class., (*5)

Let's assume that your structure looks like this:, (*6)

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

Your grunt.config.php could look like this:, (*7)

<?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., (*8)

The Versions

17/10 2015

dev-master

9999999-dev https://github.com/thedava/gruntfile-generator

A PHP based Gruntfile.js generator

  Sources   Download

LGPL

The Requires

 

25/09 2015

dev-issue-2-add-unittests

dev-issue-2-add-unittests https://github.com/thedava/gruntfile-generator

A PHP based Gruntfile.js generator

  Sources   Download

LGPL

The Requires

 

25/09 2015

1.0

1.0.0.0 https://github.com/thedava/gruntfile-generator

A PHP based Gruntfile.js generator

  Sources   Download

LGPL

The Requires