drazik
Posted on September 22, 2022
I always used space for indentation. But lately I got convinced that tabs are better. So I switched to it for my new projects, enforced by Editor Config and Prettier.
My preference is one tab equals two spaces. But by default my browser's (Firefox) default tab size is 8. So I wanted to tweak it.
Unfortunately, I couldn't find a setting related to it. But I found the CSS tab-size
property. This property existence and good browsers compatibility means that if I can apply tab-size: 2;
by default on all pages I visit, my preference will by applied.
To do that, I downloaded the Stylus extension and created a custom stylesheet with the following CSS code:
body {
tab-size: 2;
}
And voilร ๐. Now I simply author my source code with tabs, my editor is configured to respect my preference for tab size and my browser also respects it. And every person that reads my code can also just set their tab size to their preferred value without me proclaiming "your should read it this way".
PS: please don't fight between spaces and tabs here. This post is not intended to elaborate on this question, but to help people looking for ways to configure their browser's default tab size.
Posted on September 22, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
September 30, 2024
July 30, 2024