My team is looking for a more modern workflow to create custom WordPress themes and came across roots.
We’re all in windows and we currently use WAMP, underscores blank theme, and compile scss manually.
It looks like roots requires a vm to run in a windows environment. In my experience vm environments are cumbersome and can be difficult to work in.
My question is, can we take advantage of sage and bedrock while still utilizing WAMP locally? Also, is there best practice to sync DB between the team? Does anyone have a method for including the db in the repo for version control?
I’m not on Windows, I’m on macos, but I’m not using a VM, I’m on MAMP and it works fine. I imagine the setup is relatively the same.
As for pushing your database to a repository, I would advise against it, because it can grow your repository very quickly. Rather use a tool like WP Migrate DB Pro - Push/Pull Your WordPress Database & Files - to keep your database in sync with different environments.
Welcome! Let’s define some terms first: Sage is a starter theme with a slick templating system, Sass and JS pipelines, Browsersync, etc. In order to use Sage’s preview features, you need to have some sort of development environment (a web server serving WordPress) on your computer. This doesn’t have to be a VM, it could be a WAMP environment.
Bedrock is a boilerplate to build WordPress projects. The advantage of Bedrock is dependency management with Composer and a directory structure that looks and behaves more like a modern web app. Bedrock does not require a VM to operate either.
Trellis is where VMs come in. Trellis is a set of Ansible playbooks designed to provision your development, staging, and production environments (if you have those things) to be identical (no weird PHP bugs that only appear on production here!) and to deploy to those environments with a single command. In the case of development, Trellis uses an Ubuntu Linux virtual machine because that’s what staging and production will be and we want them identical.
Whew. OK.
In my experience using Trellis to manage, provision, and deploy to your environments is your best bet when working on WordPress projects as a team. It’s designed to work well with Git and keep your config management under control.
If you have any specific questions about best practices I can do my best to recommend, too!
Maybe, but I wouldn’t recommend it. If you’re on Windows, our official position is you should be using WSL (in which case if you’re determined to avoid VMs you’d be on…LAMP, I guess).
Don’t do this. DB dumps are not something you should be tracking in a repo–it’s a potential security concern, but it’s also just not how version control should be used. If you need to share a DB, @Bart’s suggestion to use WP Migrate DB Pro is a good one, as is our sync script. If those don’t meet your needs, you could fairly easily roll your own with WP-CLI.
This might have more to do with the windows part of this paragraph than the vm part of it. Obviously everyone’s experience is different, and working with vms does have a learning curve (and can be frustrating) but in my opinion it’s well worth the additional investment: It prevents your local machine from becoming inextricably tied to your development process, which introduces problems and makes debugging difficult.
If you haven’t already, I’d strongly recommend reading through our “12-Factor App” to understand the way that Roots approaches development, both mechanically and philosophically.