While writing code making sure, for example, I'm access the correct array property I keep refreshing the browser.(Or, that I didn't make a semantic mistake like that last sentence but in code) Is there a very simple and quick why to set up tests to do this instead? Simple test module seems like a huge deal and overkill. I love using Grunt watch while working with node.js. Is there an equivalent in Drupal?

2 Answers 2


As you're comfortable with Grunt, I've got a Gruntfile that I wrote that I use as a stub for most projects. You can find it here github.com/Chapabu/grunt-drupal-standards/. Just clone it to your project root and follow the installation instructions.

There are Drupal specific tasks there for doing to following:

  • PHP linting of any custom code
  • JS linting
  • CSS linting
  • Automatic clearing of theme registry when new templates are found
  • PHP_CodeSniffer tasks to ensure your code mets the Drupal Coding Standards

I need to make a few updates (i.e. remove Casper stuff, remove Compass tasks as I now use Libsass etc) but the tasks that are there should be enough to get you started.

There are also Grunt tasks for running PHPUnit tests or PHP Mess Detector (to name a couple of helpful suites) so it's pretty easy to add tasks to watches.


If you're already familiar with using Grunt, there's nothing stopping you from using it with Drupal. Grunt installs the same way on Drupal as with any other site.

Just a a couple of the many useful node-modules you could make use of are:

grunt-contrig-jshint (Can be configured to alert you to potential JS errors as soon as you edit the JS)

grunt-phplint (Can alert you to potential PHP errors whenever you edit PHP files)

Livereload - Can be set up to automatically update the page content without refreshing (For CSS and image modifications)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.