Per-Project Whitespace with EditorConfig
Standards can change from project to project. Single quotes or double quotes? MooTools, Dojo, or micro-frameworks? And then the question that has started wars: spaces or tabs? I'm a tab guy myself but the team that I work on has set a two-space standard. It's not my preference but it was a team decision so I have to drink the Kool-Aid. I still want to use my typical tab whitespace on other projects but just this one project should use spaces. I thought this would be a nightmare but enter EditorConfig, a utility with plugins for several text editors which allows developers to specify settings per project.
Start by creating a .editorconfig and placing it at the root of the project which you'd like to create whitespace for:
Once the file is in place, it's up to you to set the spacing settings per file type as you wish:
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
# 4 space indentation
indent_style = space
indent_size = 4
# Tab indentation (no size specified)
indent_style = tab
# Indentation override for all JS under lib directory
indent_style = space
indent_size = 2
So not only can you set spacing per project but you can set them per file too. I've found EditorConfig to be a lifesaver as I can code per usual without having to think about spaces or tabs. EditorConfig made my day!
Save 20% with discount code
I've always seen Digg as a very progressive website. Digg uses experimental, ajaxified methods for comments and mission-critical functions. One nice touch Digg has added to their website is their hover share widget. Here's how to implement that functionality on your site...
Tabular data can oftentimes be boring, but it doesn't need to look that way! With a small MooTools class, I can make tabular data extremely easy to read by implementing "zebra" tables -- tables with alternating row background colors.
The above CSS is extremely basic....
With all of my recent command line tutorials, I've really gotten excited about the shell's simplicity and realized the true power of using the underlying technology of pretty UIs. Since I work from home, I spend a lot of time on video calls, so when...
I'm as much of a fan of application UIs as anyone else but I'm finding myself working more and more from the command line lately. Much of that is becoming obsessed with media manipulation but I'm forcing myself to use less UIs so that I...
When I conned my way into my first professional programming gig, I didn't really think much about money -- just that I was getting my foot in the door. But as my career has gone on, I've been more aware of money, investing, and retirement. I've recently...
One interesting aspect of web development is geolocation; where is your user viewing your website from? You can base your language locale on that data or show certain products in your store based on the user's location. Let's examine how you can...
Visuals are everything when it comes to media. When I'm trying to decide whether to watch a video on Netflix, it would be awesome to see a trailer of some kind, but alas that isn't available. When I'm looking to download a video on my computer,...