Deploying Drupal Updates with Gulp

Gulp is a great tool for automating your development workflow (compiling SASS files, minifiying JS, etc.) It can also be a great tool for updating your Drupal site. The multiple steps of logging in, enabling maintenance mode, uploading files (being careful not to overwrite the sites folder) and running update.php can be replaced with a single "gulp deploy" command.

You will need shell access to your server.

Installing Drush on the Server

SSH into your server and grab the latest version of Drush using the following command.

wget http://files.drush.org/drush.phar

After the download is complete, enter the following commands to make the file executable and move it to your /usr/local/bin folder, where it will be accessible from any path.

chmod +x drush.phar
sudo mv drush.phar /usr/local/bin/drush

Try it out. Change to the directory containing your Drupal site and enter the following command.

cd /path/to/your/website
drush cc

You've just cleared your site's cache!

Installing Gulp

We're back on our local computer now.

We'll use NPM to install Gulp, and a number of useful Gulp modules. NPM is a package manager that allows us to easily install, remove, and update Node modules (Gulp is written in Node). The following command will check to see if NPM is installed. If you get "command not found", download and run the Node.JS installer.

npm --version

The following command will install Gulp globally (note the -g). This means we can use Gulp from the command line anywhere.

npm install gulp -g

We also need Gulp added to our project. Change to your project folder and enter the following command.

cd /path/to/your/project
npm install gulp --save-dev

If you're unfamiliar with Node, you'll notice two additions to your project; a package.json file and a node_modules folder. package.json contains a list of the Node modules used by your project, and node_modules contains those modules. The --save-dev parameter automatically adds the module to your project's package.json file.

Keywords

  • Await 1
  • B-Splines 1
  • Bezier 1
  • Binary 1
  • Bluetooth 1
  • Canvas 1 2
  • Curves 1
  • Drupal 1
  • Gulp 1
  • JavaScript 1 2 3
  • PHP 1
  • Promises 1
  • Xdebug 1