Comments (16)
@mdo - Could your syntax tab rules be simplified to "Use soft tabs—they're the only way to guarantee code renders the same in any environment." ?? The reason for "two" also confounded me when I started learning your standards. Most other style choices seem to have a practical reason beyond your initial feeling.
from code-guide.
I don't mean to sound dick-ish or arrogant, it's simply matter of fact. If you use tabs, someone's dev environment might have 8-space tabs and you 4-space. With soft tabs, the same spaces in one piece of code can be copy-pasted to another person's computer and will render the exact same because a space is a space. One person's tab doesn't always equal another person's tab.
from code-guide.
Out of curiosity is there any particular reason that you use 2 spaces instead of 4? For me personally I find it harder to see indentations when they are only 2 spaces long but it could just be what I am used to.
from code-guide.
You can fit more onto the screen, and you also save space by having two spaces instead of four.
from code-guide.
I disagree.
It is more readable to use hard indents, and then mnify your code for
production.
Human readability is more important during development, and simple
minification like Grunt solves any specific issues for production.
Ganginator
Jesse Gangi
jessegangi.com
(218) 310-2447
[email protected]
@Ganginator https://twitter.com/Ganginator
On Sun, Jul 27, 2014 at 9:09 PM, Zack Gold [email protected] wrote:
You can fit more onto the screen, and you also save space by having two
spaces instead of four.—
Reply to this email directly or view it on GitHub
#102 (comment).
from code-guide.
Why don't you prefer the number of spaces I prefer!?
from code-guide.
Sorry, didn't mean to start a war, was just wondering if there is any major benefit or logical reasoning behind using 2 spaces instead of 4. IMO the benefits that @zg mentioned are very minimal compared to the decrease in legibility that it causes (for me anyways).
from code-guide.
I understand that everyone has their preference.
And I have much respect for you all, so I must state that there is no
negativity.
However, I do choose to do hard tabs in development for readability, and
then choose to minify in production after for performance.
Ganginator
Jesse Gangi
jessegangi.com
(218) 310-2447
[email protected]
@Ganginator https://twitter.com/Ganginator
On Sun, Jul 27, 2014 at 9:45 PM, Josh [email protected] wrote:
Sorry, didn't mean to start a war, was just wondering if there is any
major benefit or logical reasoning behind using 2 spaces instead of 4. IMO
the benefits that @zg https://github.com/zg mentioned are very minimal
compared to the decrease in legibility that it causes (for me anyways).—
Reply to this email directly or view it on GitHub
#102 (comment).
from code-guide.
I don't think there is any particular reason to have 2 spaces instead of 4. Use what suits you (and your team) best. The goal of any style guide is to have a commonly agreed set of rules. Same goes for tabs. The important thing here is that all code in the project must look like it has been written by the same person.
from code-guide.
This issue was closed, and hasn't been reopened, so clearly he's going with two spaces.
from code-guide.
I'm not debating that it should be anything else I am just asking what the reasoning was (if any) behind using 2 spaces instead of 4. He explained above why he chose spaces over tabs but he didn't really say why he chose 2 spaces over 4 spaces.
from code-guide.
from code-guide.
^ ?
from code-guide.
Two spaces feels less of a waste of space and makes small chunks of code feel more related to each other. I'm just super used to it at this point—the number of spaces doesn't matter as much, so long as they are spaces.
from code-guide.
@mdo thanks for your input. I'm a fairly new coder and am just trying to make sure I don't adopt bad habits that are much harder to break later on.
from code-guide.
Use tabs to indent, and spaces to align. Make sure the two don't touch. Simple.
That way, anybody can use whatever indentation size they want without breaking column alignment. Also, I can't stand reading code indented with 2-space soft-tabs. It drives me CRAZY.
from code-guide.
Related Issues (20)
- Missed letter "н" in word "переработаы" in Russian translation in css-organization section
- Remove 'ie-compatibility-mode.html'
- центрирование
- оодл
- link break HOT 2
- Attribute order for onclick event attributes HOT 2
- 哈哈
- Suggest using logical properties
- Add 'how to organize HTML code for better SEO' section HOT 2
- Code Guide Link to Bootstrap Property Order for Stylelint Broken HOT 1
- Add new JS section
- Some additional HTML updates
- Typo on table of content
- Missing Complete List of Properties & Their Order HOT 1
- Unclear media query placement example
- Was just wondering what your policy was on #IDs HOT 3
- html HOT 1
- Dz1
- grid
- html HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code-guide.