Helpful LESS mixin to convert hex value to rgba

Recently I was trying to come up with a way to assign a LESS color variable to an element’s background and give it some transparency (WITHOUT using opacity). The rgba function seemed to be the wisest choice, but I had a bunch of hex colors defined in my LESS sheet, not rgba values. Luckily, I was able to come up with a useful mixin to convert my hex colors into rgba so I could assign an alpha level to them.

.bg-transparent(@color, @alpha: 1) {
  background: rgba( red(@color), green(@color), blue(@color), @alpha);


.rule-1 {
  .bg-transparent(#0b3307, .5);

will output the following after being compiled by LESS:

.rule-1 {
  background: rgba(11,51,7,0.5);

Auto Format HTML in Sublime Text

If you’re looking to auto format HTML with Sublime Text, you’ll be disappointed to know that there isn’t a default command to do this. However, because of a healthy community of developers, there is a plugin to achieve this.

For instructions on how to install and use, refer to the project’s github page: Sublime HTML Prettify

WordPress Development Workflow Tips

Wordpress logoWordPress is becoming increasingly popular amongst web developers. If you’re new to developing with WordPress, here are some quick tips that could save you a little bit of time.

Get Version Controlled

If you’re not comfortable with git yet, I highly recommend you get up and running with it. There are tons of great tutorials out there. The one I used can be found here. It’s a 70 min video but is very good at explaining how git works.

What files should I version control?
Here is a gist I yanked from github that is everything you need to know about version controlling WordPress.



If you find a different/better WordPress .gitignore, let me know in the comments.

This gist has saved me a lot of time of fiddling with different .gitignore configurations.

Work Locally

XAMPP or MAMP both work great. Or if you want to use OS X’s built in apache, that’s fine too. Whatever allows you to run apache, MySQL, and PHP will work.

I use MAMP when I’m at work on a Mac and XAMPP when I’m home on a PC. They both achieve the same goal. I can work locally on my WordPress site. I can tinker with PHP and test without worrying about bringing down my production server or bogging it down.

Local configuration vs. production configuration
Now, chances are, the settings within your wp-config.php file will be different on your local server than your production server. There are multiple ways to handle this.

The way I use was posted by Mark Jaquith on his blog. It’s a clever way of dealing with the local vs production dilemma that all WordPress devs have encountered at least once.

Another quite good reference point on the matter is this article, which takes into account version control as well.

Use Node.js & Grunt

If you want to completely supercharge your WordPress workflow, look into using Node.js and Grunt to run repetitive tasks. I might write my own article on this eventually, but until then I would highly recommend looking at an article by Matt Banks about WordPress development and deployment with Grunt.