When I work with WordPress, I am still a ruby coder in a PHP environment. I spent several years doing PHP only and have watched the language develop nicely, but still like to focus on Concept/Design, CSS3, Ruby and JavaScript when I’m doing web development work. In the hope that someone might benefit from my workflow, I’m sharing my basic setup.
First, I work on a Mac, so my workflow is fundamentally BSD based and ruby-centric due to my background.
Tools
I use the following tools:
- rvm enables a custom and tailorable environment
- Bundler makes it easy to get the dependencies I need — huge timesaver
- MAMP probably easy to do this from scratch, but MAMP is free and a pretty convenient package for Apache, Mysql and PHP
- Compass Really good sass/css minification
- Guard (with LiveReload) every time I update a file, a bunch of cool stuff happens and I can see the results in my browser
- CoffeeScript a beautiful way to write javascript
- Juicer A good way to combine and minify css
- Chrome The webbrowser with the amazing developer toolset
Making it work
First, I want to establish multiple database entries. To do this I needed to activate virtual hosts and php5 from /private/etc/apache2/httpd.conf. I uncommented the following lines.
LoadModule php5_module libexec/apache2/libphp5.so and # Virtual hosts Include /private/etc/apache2/extra/httpd-vhosts.conf
It is important to note that I had to change the url in order to get a successful login in wp-config.php:
define('WP_HOME','https://www.theboohers.org.dev/'); define('WP_SITEURL','https://www.theboohers.org.dev/');
I also had to change the DBHOST to match the alias in my /private/etc/hosts file:
define('DB_HOST', '127.0.0.1'); # not define('DB_HOST', 'localhost');
Since my /private/etc/hosts has:
127.0.0.1 theboohers.org.dev
which resolves to the following virtual host: (in /private/etc/apache2/extra/httpd-vhosts.conf):
<VirtualHost *:80> DocumentRoot "/Users/tim/Sites/wordpress_themes/theboohers.org/public_html/" ServerName theboohers.org.dev ErrorLog /Users/tim/Sites/wordpress_themes/theboohers.org/logs/error.log CustomLog /Users/tim/Sites/wordpress_themes/theboohers.org/access.log combined </VirtualHost>
In order to override the default httpd.conf file, I created a user file, tim.conf in /private/etc/apache2/users/tim.conf
<Directory "/Users/tim/Sites/wordpress_themes/"> Options Indexes MultiViews AllowOverride All Order allow,deny Allow from all </Directory>
I used SCP to pull down my files from the working server, but had to update my .htaccess by adding Options FollowSymLinks to the top:
Options FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond {aaa01f1184b23bc5204459599a780c2efd1a71f819cd2b338cab4b7a2f8e97d4}{REQUEST_FILENAME} !-f RewriteCond {aaa01f1184b23bc5204459599a780c2efd1a71f819cd2b338cab4b7a2f8e97d4}{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
Now, I need to get my workflow down. This involves Guard, Compass, and Juicer. This is the part I think most folks are going to pay attention to: