Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From \$16.50/m

# An Update on Nettuts+ Prefixr

Length:ShortLanguages:

Many of you might be aware that we recently launched a helpful web service, called Nettuts+ Prefixr. Thankfully, the tool has come a long way since the initial launch, as I've squashed countless bugs, and added some neat new features. I'd like to give you a quick rundown on the current state of the tool, as well as how to use it.

## Wait - What is Prefixr?

Prefixr takes all of those pesky CSS3 prefixes that we must type over and over, and does away with them! If you create your stylesheets using the official syntax, you may then, at deployment, run your clean stylesheet through Prefixr, and it'll instantly update your stylesheet to include every required prefix.

This way, you don't have to deal with remembering whether or not a particular CSS3 property requires a -ms prefix or not. That knowledge is built into Prefixr.

Let's review a quick example. Below, I have some scattered CSS that is badly in need of updating. Notice that, in some places, we've only declared a -moz prefix; in other areas, we've used the official syntax, etc.

Copy the code above, and paste it into Prefixr. In return, you'll receive:

Wow - that's a lot of duplicate styling. But, unfortunately, it's necessary at this point in time. If you want your web applications to be as consistent as possible from browser to browser, you need to use these various prefixes. However, as you can imagine, this can quickly bloat your code. That's why Prefixr is so helpful!

Create your stylesheets using the official syntax, and then run it through Prefixr when you deploy, or when you need a conversion.

## I Don't Want to Copy and Paste into Prefixr

No worries! I don't either. Visiting Prefixr.com is only one way to update your stylesheets. I much prefer to use it within my favorite code editor. Thanks to various users, there are a handful of plugins and scripts available for the most popular editors. For example, as a Sublime Text user, I personally use Will Bond's "Sublime Prefixr" plugin, which works wonderfully.

Now, I never to have to manually visit Prefixr and copy and paste my stylesheet. I simply select the bit of CSS that I wish to optimize, and type ctrl+alt+x on Windows and Linux, or cmd+ctrl+x on OSX.

### Editors List

Refer below for the current list of supported editors.

### TextMate Commands

There are countless TextMate users out there; let's create a command that will run a selection through Prefixr, and place the result in the clipboard. Within TextMate, browse to the Bundle Editor, and create a new command.

Paste the following into the "Command" textarea. This will take the selected text, run it through Prefixr, and copy the response to your clipboard. Next, assign an activation key, and you're all set! This is helpful if you'd prefer to store the Prefixed results in a separate stylesheet.

Or, if you'd prefer the result to be compressed, modify the command, like so:

Select the stylesheet, type the activation key that you assigned, and the following should now be stored in your clipboard (assuming you use the compress option).

## Can I Use Variables?

Prefixr isn't the same type of preprocessor as Less, Stylus, or Sass. I love those - Sass and Stylus particularly. Prefixr is instead for the folks who dislike the idea of using them. That said, variables do come in handy, so if you'd like to use them in Prefixr, it will automatically update your stylesheets. For example:

Run it through Prefixr, and we get:

It's important to note that this is entirely an optional feature. If you feel that variables complicate CSS, then don't use this feature!

## Requests?

Nettuts+ Prefixr is under active development, so if you notice a bug or would like a new feature to be implemented, either leave a comment below, or click on the "Feedback" button at Prefixr.com.