4 ms·
No leading zeros?! [1] I'm pretty sure most math/engineering fields recommend leading zeros for readability, e.g, NIST: "For numbers less than one, a zero is wr
by anonova 12y ago
No leading zeros?! [1] I'm pretty sure most math/engineering fields recommend leading zeros for readability, e.g, NIST: "For numbers less than one, a zero is written before the decimal marker. For example, 0.25 s is the correct
form, not .25 s." [2]
If it's to make the resulting css file a byte smaller, shouldn't be the preprocessor be able to strip it out?
[1]: http://sass-guidelin.es/#zeros http://sass-guidelin.es/#zeros
[2]: http://physics.nist.gov/cuu/pdf/sp811.pdf http://physics.nist.gov/cuu/pdf/sp811.pdf
- HugoGiraudel 12y agoActually I am thinking of changing this. Someone brought the issue on GitHub: https://github.com/HugoGiraudel/sass-guidelines/issues/32 https://github.com/HugoGiraudel/sass-guidelines/issues/32. It is currently being discussed.
- wldcordeiro 12y agoIn a similar vein why do you prefer hex colors in shortened lowercase format? I've been partial to uppercase long form.
- pc86 12y agoThis is not in a similar vein. Leading zero's for values less than 1 is the correct way to write values less than 1. 3-character or 6-character hex values is only a matter of optimization (fewer characters, which the compiler should be able to handle), and consistency (having both the 3- and 6-character versions in the same file or definition). Case is personal preference and nothing more.
- Bognar 12y agoSeconding this. Leading zeros are important for decimals because it is extremely easy to miss a single dot. This is less of an issue in the world of fixed width fonts, but I don't really think that's a valid excuse to buck the trend of every other engineering field.
- HugoGiraudel 12y agoIt has been updated.
- kendallpark 12y agoWell done!
- kolev 12y agoYou still have it here: // Yep .element { color: rgba(0, 0, 0, .1); background: hsl(300, 100%, 100%); } // Nope .element { color: rgba(0,0,0,.1); background: hsl( 300, 100%, 100% ); }
- HugoGiraudel 12y agoFixed, thank you very much. :)
- kendallpark 12y ago+1 The scientist in me... skin crawls when I see a lack of leading zeros.
- paulojreis 12y agoI agree. Even within the relevant field (front-end development), explicit leading zeros are encouraged. JavaScript code quality tools such as JSHint and JSLint will complain when the leading zero isn't explicit. E.g: JSHint var foo = .1; // Unexpected '.'. JSLint var foo = .1; // A leading decimal point can be confused with a dot: '.1'.