Grunt Tasks For Yii Project


(Doug) #1

I’ve created a Yo generator that creates a pre-built Gruntfile.js and package.json in your projects root directory which has a number of tools I’ve found useful for managing your Yii project.

GitHub Page: https://github.com/OdinsHat/generator-gruntfile-yii

Generator Package Page: https://www.npmjs.org/package/generator-gruntfile-yii

Once installed (using the instructions on either of those pages above) you can run tasks like:


grunt -h #show tasks

Run all default tasks (PHP Lint, PHP CS, PHP Mess Detector, PHPCPD, etc


grunt

Run PHP Code Sniffer on all components, controller & models


grunt phpcs 

As above but only on models


grunt phpcs:models

As above but only on controllers


grunt phpcs:controllers

Run PHP Mess Detector on controllers


grunt phpmd:controllers

Run PHP Copy/Paste Detector on models


grunt phpcpd:models

Run PHP Mess Detector on all compnents, controller & models


grunt phpmd

Many, many more - check the grunt file and feel free to edit to your needs.

Feel free to contribute with ideas, issues, bugs and pull requests.