I read topics on the deploys section here. It seems there are different products for deploy Roots. So if I don’t want to use anything else, but just git. What is the best approach?
Here are my steps:
- git clone on production to install theme
- manually copy generated files to assets folder on production.
Roots is just a WordPress theme. How you choose to deploy your WordPress installation is entirely up to you and there are countless ways.
There isn’t anything technically wrong with your existing steps, but the deploy method developers choose usually depends on many factors. If that works for you right now then no sense fixing something that isn’t broken.
@cfx put it well…
If you’re just trying to deploy your files, a simple copy and paste via FTP of the entire theme directory is probably the easiest way to do it. I don’t upload the node_modules folder because you don’t need it and it’s usually pretty big.
One step above that simple way to do it would be to use git to track your entire theme directory/folder, and use a service like Beanstalk, FTPloy, or DeployHQ to manually deploy commits to your development server when you make them on your localhost.
Of couse there a lots of other way to do this, but I would consider these some of the simplest approaches.
Thanks much everyone.
I’ll just have to make the theme worked before streamlining the deploy process.
@shaimoom I’ll be interested to see this in person at the WordCamp LAX. I’m doing the same thing for a site currently so this was an interesting writeup.
Considering I don’t know how to use Composer or Capistrano, I’m first learning to do this manually. I’d assume that with the Bedrock plugin the deployment procedure knows exactly which files need to be uploaded to the production server.
It’d be nice to see a little more transparency about manual deployment and what’s not necessary (like
node_modules folder) and what should be changed.
Looks awesome @shaimoom, I will see you there! Looking forward to your presentation
Thanks @asuh and @kalenjohnson. I look forward to seeing you there. I have streamlined the process by using this Gruntfile.js instead, so that grunt watch also builds the minified assets (thanks @cfx). No more fiddling with
define('WP_ENV', 'development'); The modified Gruntfile.js also activates LiveReload if one is so inclined. Here is my revised writeup with the new file.
For the purposes of this example, I am renaming the theme as ‘demo’.
###Part I: Github setup
- Create a repository at github.com named ‘demo’
- Clone Roots repository from github.com to
wp-content/themes folder as ‘demo’
- Change local Roots clone settings as follows:
- Change Primary remote repository (origin) to: https://github.com/shaimoom/demo.git (you can find this at the github.com repo for ‘demo’)
- Delete the following from Ignored files (.gitignore):
- Sync the local and remote repositories (initial commit)
###Part II: Local Dev Setup, Install Dependencies & Grunt
- Right-click on the ‘demo’ repository in Github and select ‘Open in Terminal’
npm install on theme root directory (vendor assets will be added to the theme)
grunt build (build minified assets to see Bootstrap styled theme upon theme activation)
Gruntfile.js in theme root directory with this Gist (runs build task in watch task / activates LiveReload)
grunt watch on theme root directory in terminal to track changes and build minified assets
- Activate LiveReload in Chrome Extensions
- Activate theme
- Activate theme on production site
###Part III: Deployment
- Make a change to local theme
- Create a commit in Github and sync
- Go to Deploy Add SSH & SFTP info (including theme file path)
- Click ‘Deploy Now’ to deploy from latest commit
- View changes deployed to production site
Repeat Part III to deploy local changes to production site (except step 3 - that is for setting up Deploy for the first time only).
Looks great! Thanks for the shout out