generator-gruntfile-yii
v0.1.5
Published
A Gruntfile.js generator for Yii projects
Downloads
2
Maintainers
Readme
Gruntfile for Yii Generator
Yeoman generator or creating a package.json and Gruntfile.js with relevant tools and questions for a Yii project.
The generator is based on Addy Osmani's great gruntfile Generator as well as using the yo generator
scaffold.
I adapted my own Yii Gruntfile which carries out tasks such as PHP static analysis of your Yii code, CSS linting and JS linting specific to the layout of a Yii project.
Installation
Be sure to run these in your web root folder.
npm install generator-gruntfile-yii
yo gruntfile-yii
You'll be asked a series of questions to help setup your Gruntfile and package.json before it goes and creates it for you.
This will install the Gruntfile.js
and package.json
into your web directory. The same directory that contains the "protected" and "assets" directories. Then npm install
will install all the required node modules. Be sure to have the prerequisites below as it will expect them.
Prerequisites
Depending on your answers in the generator you may need the following:
- PHP Code Sniffer
- PHP Mess Detector
- PHP Copy/Paste Detector
- PHP CS Fixer
- To run the
grunt php
server task you'd need PHP >=5.4 but its not compulsory.
Usage
In your Yii root folder (the one containing index.php and protected
folder) run this command:
grunt -h
show tasksgrunt
run all tasksgrunt phpcs
run phpcs tool on all compnents, controller & modelsgrunt phpcs:models
as above but only on modelsgrunt phpmd
run PHP Mess Detector on all compnents, controller & models- Many more - check the grunt file and feel free to edit to your needs.
##Contributions This is my first generator - please report any bugs or issues you find All are very welcome and I'm very happy for you to submit bug reports, feature requesats and even better - pull requests.
Thank you!