<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Andrei Andreev</title>
    <description>The latest articles on DEV Community by Andrei Andreev (@andrei_says).</description>
    <link>https://dev.to/andrei_says</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F95714%2F0183f955-dc62-454b-900d-4fc92824a9a8.jpeg</url>
      <title>DEV Community: Andrei Andreev</title>
      <link>https://dev.to/andrei_says</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/andrei_says"/>
    <language>en</language>
    <item>
      <title>Organized, clean approach to SCSS variables</title>
      <dc:creator>Andrei Andreev</dc:creator>
      <pubDate>Tue, 26 Feb 2019 00:48:42 +0000</pubDate>
      <link>https://dev.to/andrei_says/organized-clean-approach-to-scss-variables-3ccp</link>
      <guid>https://dev.to/andrei_says/organized-clean-approach-to-scss-variables-3ccp</guid>
      <description>&lt;p&gt;I am a lazy man with a lot on my plate. I like clarity and efficiency, and I dislike memorizing things. &lt;/p&gt;

&lt;p&gt;There's an approach to SCSS variables I use in all my projects -- an approach which works with my mind's habits and saves me typing. &lt;/p&gt;

&lt;p&gt;An example of the technique, applied:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;p {
  color: c(body-text);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The data structure and SCSS function making this possible:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// the data map
$colors: (
  body-text: rgba(#000, 0.9),
  body-link: #33c,
  // etc.
)

// the function
@function c($the-color) {
  @return map-get($colors, $the-color);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I use this with colors &lt;code&gt;c(color)&lt;/code&gt;, with breakpoints &lt;code&gt;bp(phone-landscape)&lt;/code&gt;, with "magic numbers" - &lt;code&gt;n(w-desktop-max-width)&lt;/code&gt; etc.&lt;/p&gt;

&lt;p&gt;DRYs the project, keeps the namespace clean and makes it easy to look stuff up.&lt;/p&gt;

&lt;p&gt;Happy coding and let me know if you use similar tiny time-savers! &lt;/p&gt;

</description>
      <category>css</category>
      <category>scss</category>
    </item>
  </channel>
</rss>
