3 ms·
If I go through replacing all of the !blue with !green in my files, I might as well replace #0000ff with #00ff00. Your variable names represent a value, not a
by evlapix 16y ago
If I go through replacing all of the !blue with !green in my files, I might as well replace #0000ff with #00ff00.
Your variable names represent a value, not a color. You should ask yourself what the function of that value is before naming the variable.
But that's just me. CSS is not something you can let slide. Adding templates, widgets, and pages on a mass scale (20+ templates, 30+ widgets, 500+ pages), your CSS deficiencies will show quickly.
- isleyaardvark 16y agoI should've said "You should add an intermediate variable" instead of "Or add an intermediate variable". If you were to name a variable !blue, it should be treated like a global variable, and only used in matters of say, the color palette of a site, and not the particular color used in sidebar.
- carbon8 16y agoAgreed. I do the exact same thing. First define a palette and with variable names that describe the color (eg, !mauve= #E0B0FF), then assign those to descriptive variable names (eg, !accent_color= !mauve). That way it's immediately clear which colors are being used while also avoiding the need to replace variable names throughout the partials.
- evlapix 16y agoCan the same not be accomplished with a comment?
- carbon8 16y agoSure, if you want to leave the same comment in every place you assign a particular hex value to one of the descriptive variables and don't mind changing each of those duplicated hex values if you ever need to tweak the color. Personally, I don't see the benefit of using comments when using variables is already self-documenting and further avoids possible duplication of hex values.
- evlapix 16y agoI think you misunderstood me, which is understandable.. I was unclear. The comment question wasn't meant to be combative. I agree and can see the benefit/use. Thanks for being patient with me while I explore alternative solutions.