<?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: Ryan Wood</title>
    <description>The latest articles on DEV Community by Ryan Wood (@gtyrkicksin216).</description>
    <link>https://dev.to/gtyrkicksin216</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%2F168759%2F79254abe-8ded-4738-b99e-dbe375e7716c.jpeg</url>
      <title>DEV Community: Ryan Wood</title>
      <link>https://dev.to/gtyrkicksin216</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gtyrkicksin216"/>
    <language>en</language>
    <item>
      <title>Blast off! Astro 2.0 Has Arrived 🚀</title>
      <dc:creator>Ryan Wood</dc:creator>
      <pubDate>Wed, 25 Jan 2023 05:33:21 +0000</pubDate>
      <link>https://dev.to/gtyrkicksin216/blast-off-astro-20-has-arrived-4ild</link>
      <guid>https://dev.to/gtyrkicksin216/blast-off-astro-20-has-arrived-4ild</guid>
      <description>&lt;p&gt;Today (1/24) the Astro team announced the official release of version 2.0 of the framework. If you haven't used, or heard of Astro, it's a web framework used to build fast, content-focused websites. Astro implements islands architecture. This means that JavaScript is only shipped to the client when absolutely necessary. With this, Astro makes it easy to build performant sites, either Static or SSR, and still have interactivity where needed through islands. There are plenty of other benefits like accessibility, SEO, and more. That's another story for another time.&lt;/p&gt;

&lt;p&gt;Enough about what Astro is though. Keep an eye out for another article about using Astro. Until then, check out the &lt;a href="https://docs.astro.build/en/getting-started/" rel="noopener noreferrer"&gt;Getting Started Docs&lt;/a&gt;. If you're already using Astro you can check out the &lt;a href="https://docs.astro.build/en/guides/upgrade-to/v2/" rel="noopener noreferrer"&gt;Migration Guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's New 🆕
&lt;/h2&gt;

&lt;p&gt;Astro already provides phenomenal DX that makes creating Static or SSR websites with ease. Simply build your site the Astro way, add islands with the framework/library of your choosing, add an adapter for the platform you plan to deploy to, and deploy. With Astro 2.0 there are some great improvements to further improve the DX of building with the framework.&lt;/p&gt;

&lt;h3&gt;
  
  
  Content Collections 🗂
&lt;/h3&gt;

&lt;p&gt;Astro allows you to use Markdown and/or MDX to write your content. With the new &lt;a href="https://docs.astro.build/en/guides/content-collections/" rel="noopener noreferrer"&gt;Content Collections API&lt;/a&gt; you group your collections under the &lt;code&gt;src/content&lt;/code&gt; directory. This allows you to better organize your content, &lt;em&gt;make your content in the collections type-safe&lt;/em&gt;, and &lt;em&gt;validate frontmatter&lt;/em&gt;. While you may have already been organizing your content in a similar way before, those last two points are a massive gain. You no longer have to go searching for the source of an error where you may have misspelled something in your frontmatter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hybrid Rendering 🏆
&lt;/h3&gt;

&lt;p&gt;For me, and I'm sure for many others, this is a stellar (insert rimshot GIF here) addition. Now you can determine which pages are Static (prerendered) and which are SSR. This is something I really enjoy in SvelteKit and it has now been added here as well. Simply add &lt;code&gt;export const prerender = true&lt;/code&gt; to the routes that you want to be Static and those routes will be rendered during the build rather than on the server. Let's say that you have an e-commerce site with a &lt;strong&gt;store&lt;/strong&gt; and an &lt;strong&gt;about&lt;/strong&gt; route. You may want to prerender your &lt;strong&gt;about&lt;/strong&gt; route since it likely doesn't change, however you'll want your &lt;strong&gt;store&lt;/strong&gt; to be SSR so your users can check out your cool new items as soon as you add them. With Hybrid Rendering, this is now an extremely simple task.&lt;/p&gt;

&lt;h3&gt;
  
  
  Improved Error Overlay 🧯
&lt;/h3&gt;

&lt;p&gt;With the new and improved error overlay you get more information about errors, links to help you resolve the error, and the ability to click a button to open your code in an editor of your choosing.&lt;/p&gt;

&lt;h3&gt;
  
  
  And more...
&lt;/h3&gt;

&lt;p&gt;There are more improvements included as well, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update to Vite 4.0&lt;/li&gt;
&lt;li&gt;Dev Server Optimizations&lt;/li&gt;
&lt;li&gt;&amp;amp; Public Roadmap&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Wrap It Up 🎁
&lt;/h2&gt;

&lt;p&gt;Astro was already pretty impressive, and with this latest release continues to be even more impressive. As I mentioned previously, stay tuned for my series on creating a site with Astro. In the meantime, check out the &lt;a href="https://astro.build/blog/astro-2/" rel="noopener noreferrer"&gt;official Astro 2.0 blog post&lt;/a&gt; for more information and links, and go build something cool with Astro!&lt;/p&gt;

</description>
      <category>leadership</category>
      <category>career</category>
      <category>productivity</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Private vs. Public (Part 3)</title>
      <dc:creator>Ryan Wood</dc:creator>
      <pubDate>Wed, 09 Oct 2019 03:52:28 +0000</pubDate>
      <link>https://dev.to/gtyrkicksin216/private-vs-public-part-3-3oad</link>
      <guid>https://dev.to/gtyrkicksin216/private-vs-public-part-3-3oad</guid>
      <description>&lt;p&gt;The new module system for Sass allows for certain members to be private, while others may remain publicly exposed for consumption.&lt;/p&gt;

&lt;p&gt;This pertains mostly to library authors but this can also be wildly useful to allow developers to consume libraries, but also have the ability to adjust configurations.&lt;/p&gt;

&lt;p&gt;Library authors can now make their helpers and members private which may cause catastrophic issues when edited, and expose public configurations for those members that should be configurable. This comes in extremely handy when working with CSS UI and utility libraries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Public
&lt;/h2&gt;

&lt;p&gt;I created a CSS utility library (&lt;a href="https://www.npmjs.com/package/fulcrum-css"&gt;fulcrum-css&lt;/a&gt;) that allows developers to add simple adjustments to elements, add spacing, and provides a grid built with flexbox to control layouts. The aim being to keep code dry and give the markup meaningful and identifiable class names. The grid is currently based on a 12 column system to make it easy to transition from something like Bootstrap to this smaller utility library for your project. Wouldn't it be nice if the developer could decide the number of columns that they would like to use, and pass that to the configuration of the grid though? Previously you could declare your config variables with &lt;code&gt;!default&lt;/code&gt; and as long as you declared that variable prior to the import with the default variable your declared value would be used. You should still use &lt;code&gt;!default&lt;/code&gt; when declaring your variables, but let's take a look at how this would work with the new &lt;code&gt;@use&lt;/code&gt; rule.&lt;/p&gt;

&lt;h4&gt;
  
  
  Public members for configuration:
&lt;/h4&gt;

&lt;p&gt;Here are a few config variables that are used with this grid implementation:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P2YZXVnY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2ytjz3rntq7psnfe3yb0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P2YZXVnY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2ytjz3rntq7psnfe3yb0.png" alt="Alt Text" width="880" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What happens if we want a grid that only has &lt;strong&gt;6&lt;/strong&gt; columns:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5pjaCMiU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7uyqibrqrdhwy4sxgtuh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5pjaCMiU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7uyqibrqrdhwy4sxgtuh.png" alt="Alt Text" width="880" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How to solve this with &lt;code&gt;@use&lt;/code&gt;:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3lJ1HOOS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nkscjdvyblujfxn1cfy6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3lJ1HOOS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nkscjdvyblujfxn1cfy6.png" alt="Alt Text" width="880" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also do this with a namespace that you provide:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2b3y-NQD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/oc31j8yvfhuuqj5id5am.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2b3y-NQD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/oc31j8yvfhuuqj5id5am.png" alt="Alt Text" width="880" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Private
&lt;/h2&gt;

&lt;p&gt;By using the &lt;code&gt;@forward&lt;/code&gt; rule, library authors can decide what is able to be exposed from one module to another. If you want to allow a stylesheet to consume and imported sheets members but not allow access to them from the importing stylesheet, you simply do not forward them.&lt;/p&gt;

&lt;p&gt;First let's take a look at how to forward members of an imported module:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nOToxJWK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kwb5qb336irtacftij2v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nOToxJWK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kwb5qb336irtacftij2v.png" alt="Alt Text" width="880" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Doing this would allow the members from the &lt;em&gt;colors&lt;/em&gt; and &lt;em&gt;typography&lt;/em&gt; modules to be accessible to any stylesheet consuming this module. It is important to note that &lt;code&gt;@forward&lt;/code&gt; &lt;em&gt;does not create a namespace&lt;/em&gt;, however when importing this sheet you can access the forwarded members with the consuming modules namespace:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YaHU86KW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/w1244yszg3r377nz7xd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YaHU86KW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/w1244yszg3r377nz7xd5.png" alt="Alt Text" width="880" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here the &lt;em&gt;base-config&lt;/em&gt; module allows access to the &lt;em&gt;colors&lt;/em&gt; modules members because they were forwarded from the &lt;em&gt;base-config&lt;/em&gt; module. If you do not want to allow this, and would like to simply not forward the colors module:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gv4SClQ0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/q67rxddc8mgytiavhl9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gv4SClQ0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/q67rxddc8mgytiavhl9t.png" alt="Alt Text" width="880" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since we are no longer exporting the &lt;em&gt;colors&lt;/em&gt; module, if we try to access the &lt;code&gt;$yellow&lt;/code&gt; member through the &lt;em&gt;base-config&lt;/em&gt; module:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RCYVu_3Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gr6zbujqnxuv7z7ytxmh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RCYVu_3Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gr6zbujqnxuv7z7ytxmh.png" alt="Alt Text" width="880" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We end up with this error:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n1jhlCSA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/cgobsks3tfv5p94tusgr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n1jhlCSA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/cgobsks3tfv5p94tusgr.png" alt="Alt Text" width="880" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another way to create private members is to &lt;code&gt;hide&lt;/code&gt; them in the &lt;code&gt;@forward&lt;/code&gt; rule:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--reqz_Qzz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9nc3no3qmylpdvtpwnzc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--reqz_Qzz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9nc3no3qmylpdvtpwnzc.png" alt="Alt Text" width="880" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will keep the &lt;code&gt;$yellow&lt;/code&gt; variable private, but still expose all the other members:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RVOjpUDa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/5rxx7xj6p8x53mwccs0p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RVOjpUDa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/5rxx7xj6p8x53mwccs0p.png" alt="Alt Text" width="880" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This functionality helps library authors keep their utilities private, while also allowing them to expose public members so that the consuming application can adjust configurations provided by the author. This creates a much more robust platform for configurations when it comes to working with libraries, and I already have tons of ideas on how to improve mine with this!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you would like to see more in this series, drop a comment and tell me what you would like to know. I will do my best to get back to you, and add to this if the demand is high enough. If you would like to learn more about fulcrum-css, the utility library I created, install it with &lt;a href="https://www.npmjs.com/package/fulcrum-css"&gt;NPM&lt;/a&gt; and kick the tires of it. If you like it, give it a star on &lt;a href="https://github.com/gtyrkicksin216/fulcrum-css"&gt;github&lt;/a&gt;. If you hate it, or see something that could be added to it, feel free to open an issue regarding your feature request/comment. This library does not currently utilize the new Sass Module System but I will undoubtedly be moving it over to this shortly. I'm also working on getting a robust set of documentation for this library set up, so bear with me and if you have questions on how to use it drop me a message.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>Namespaces (Part 2)</title>
      <dc:creator>Ryan Wood</dc:creator>
      <pubDate>Wed, 09 Oct 2019 02:56:08 +0000</pubDate>
      <link>https://dev.to/gtyrkicksin216/a-hands-on-first-look-at-the-sass-use-implementation-part-2-c8f</link>
      <guid>https://dev.to/gtyrkicksin216/a-hands-on-first-look-at-the-sass-use-implementation-part-2-c8f</guid>
      <description>&lt;h1&gt;
  
  
  Namespaces
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Avoiding name collision
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;@import&lt;/code&gt;:&lt;/strong&gt; With this rule, using simple would almost guarantee that there was a possibility of these names being used elsewhere in the application, which would cause value re-declaration by those used further down in the cascade. This forced developers to create names that were overly complex and not always correlative to what they were tied to.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How &lt;code&gt;@use&lt;/code&gt; solves this:&lt;/strong&gt; This rule, as previously mentioned, creates a namespace for the members that it brings in. This means that the same name can be used since it is part of a different namespace. Say you have a light theme and a dark theme. These themes each have different blue colors that they use. With &lt;code&gt;@import&lt;/code&gt; you would likely have to name these something like &lt;code&gt;$lightThemeBlue&lt;/code&gt; and &lt;code&gt;$darkThemeBlue&lt;/code&gt;. This doesn't seem so bad right? But what if you have a white-label product that has &lt;em&gt;many&lt;/em&gt; themes that need to each have different blue colors. This could cause these names to get wildly out of control. With the new &lt;code&gt;@use&lt;/code&gt; rule, you can just name these &lt;code&gt;$blue&lt;/code&gt; in each theme module, and when imported it will be prefixed with a namespace that will ensure that you are getting the correct blue for that theme.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Let's take a look at how this works&lt;/strong&gt;&lt;br&gt;
First we have 3 theme files&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2kAhDCOj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/792l2bqbzwbyrjftaneu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2kAhDCOj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/792l2bqbzwbyrjftaneu.png" alt="Theme Files" width="880" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is what will happen with the &lt;code&gt;@import&lt;/code&gt; rule&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WE3nLIKR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7xinn6vhzxi8f530o17n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WE3nLIKR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7xinn6vhzxi8f530o17n.png" alt="Alt Text" width="880" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using the &lt;code&gt;@import&lt;/code&gt; rule, members with the same name will always evaluate the the member that has been imported last.&lt;/p&gt;

&lt;p&gt;Here is how the &lt;code&gt;@use&lt;/code&gt; rule solves this problem&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wvYDtI1S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3777lq7cs5pw0vg6v0fz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wvYDtI1S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3777lq7cs5pw0vg6v0fz.png" alt="Alt Text" width="880" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using the &lt;code&gt;@use&lt;/code&gt; rule, members with the same name are scoped to a specific namespace. This allows the same name to be reused in different sheets without overriding when multiple sheets are imported with the same member name. This means that you don't have to get creative with member names and reduce their correlative meaning to the property that they represent.&lt;/p&gt;

&lt;p&gt;We can even go a step further and change the namespace to something more concise!&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yKXp9Si1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/q405wixslqotccwfzc9l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yKXp9Si1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/q405wixslqotccwfzc9l.png" alt="Alt Text" width="880" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using the &lt;code&gt;@use 'sheet' as name;&lt;/code&gt; syntax, you can provide a custom namespace to the members of that sheet. This allows you to keep your file names meaningful, but reduce the size of the namespace by providing an alias for that sheet.&lt;/p&gt;

&lt;p&gt;You can also provide the &lt;code&gt;*&lt;/code&gt; top-level namespace to make members available without having to prefix with a namespace.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wIJ-TfUe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/c1065i1kx8sdmio0k6b5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wIJ-TfUe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/c1065i1kx8sdmio0k6b5.png" alt="Alt Text" width="880" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This can be useful for sheets that you maintain and do not want prefixed with a namespace.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Only one top-level namespace can be provided, otherwise the compiler will throw an error:&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D1H9988G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0gj517s0ac6ziva8gw2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D1H9988G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0gj517s0ac6ziva8gw2u.png" alt="Alt Text" width="880" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Will produce this error:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Nkb_BI2m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9qmug8p4l1gc4wupmlrc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nkb_BI2m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9qmug8p4l1gc4wupmlrc.png" alt="Alt Text" width="880" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similarly, if you try to use the same provided namespace an error will occur:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gz18fp9l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/97diiv59p8dm7dksgvqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gz18fp9l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/97diiv59p8dm7dksgvqj.png" alt="Alt Text" width="880" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Will produce this error:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zqlxvqz7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qeboqdre7t5osdhzlqmk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zqlxvqz7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qeboqdre7t5osdhzlqmk.png" alt="Alt Text" width="880" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With just this simple overview it is very easy to see that you could come up with wildly elaborate themes without having to come up with crazy names just to avoid collision.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In the next part (Part 3) we will take a look at how to manage private and public members and imports.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>Overview (Part 1)</title>
      <dc:creator>Ryan Wood</dc:creator>
      <pubDate>Wed, 09 Oct 2019 02:52:15 +0000</pubDate>
      <link>https://dev.to/gtyrkicksin216/a-hands-on-first-look-at-the-sass-use-implementation-part-1-3ajb</link>
      <guid>https://dev.to/gtyrkicksin216/a-hands-on-first-look-at-the-sass-use-implementation-part-1-3ajb</guid>
      <description>&lt;p&gt;&lt;em&gt;(This is my first article...so cut me some slack)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Recently while doing some research for a problem I had, I stumbled upon something that took me by surprise. Sass is removing support &lt;code&gt;@import&lt;/code&gt; in favor of &lt;code&gt;@use&lt;/code&gt;! I was amazed that I had not seen anything mentioned outside the Sass documentation, so naturally I started doing a little more digging.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is &lt;code&gt;@use&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;Well, it is part of the new Module System that was launched by the Sass team on October 1st 2019. The goal of this new at-rule is to address some issues that have been caused by the current &lt;code&gt;@import&lt;/code&gt; rule when importing "modules" in Sass. Let's first take a look at some of the issues caused by the &lt;code&gt;@import&lt;/code&gt; rule and how it will be solved by &lt;code&gt;@use&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Globally available imports
&lt;/h3&gt;

&lt;p&gt;When including modules with &lt;code&gt;@use&lt;/code&gt;, those member names are only available in the stylesheet that they are included in. With the &lt;code&gt;@import&lt;/code&gt; rule, the member names are available to every other stylesheet downstream of it's inclusion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Imports using &lt;code&gt;@import&lt;/code&gt; are executed and included every time
&lt;/h3&gt;

&lt;p&gt;When a stylesheet is imported multiple times that is how many times it will be included in your project. When importing with &lt;code&gt;@use&lt;/code&gt;, these sheets are only included and executed once.&lt;/p&gt;

&lt;h3&gt;
  
  
  Private members
&lt;/h3&gt;

&lt;p&gt;Any members which begin with &lt;code&gt;-&lt;/code&gt; or &lt;code&gt;_&lt;/code&gt; are considered private and are only available to the styleshee that they are included in with &lt;code&gt;@use&lt;/code&gt;. This was not available with &lt;code&gt;@import&lt;/code&gt; at all. Imported utilities with &lt;code&gt;@use&lt;/code&gt; can be kept private even when other stylesheets import the sheet using those utilities. This is handled with the new &lt;code&gt;@forward&lt;/code&gt; rule included with the new module system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Styles using &lt;code&gt;@extend&lt;/code&gt; are contained
&lt;/h3&gt;

&lt;p&gt;Styles applied with &lt;code&gt;@extend&lt;/code&gt; are only applied to the stylesheet it imports and not stylesheets that import it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Built in modules
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;With the new module system, the Sass team is also removing global functions and replacing them with built-in modules. This is similar to built-in module usage in Node, Python, etc. These built-in modules are:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sass:math&lt;/li&gt;
&lt;li&gt;sass:color&lt;/li&gt;
&lt;li&gt;sass:string&lt;/li&gt;
&lt;li&gt;sass:list&lt;/li&gt;
&lt;li&gt;sass:map&lt;/li&gt;
&lt;li&gt;sass:selector&lt;/li&gt;
&lt;li&gt;sass:meta&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These built in modules will have similar functions to the current global functions, however some of the implementations will be a little different. The biggest change here is that in order to use these functions, the built-in module will need to be included with &lt;code&gt;@use&lt;/code&gt; where it needs to be executed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does this mean for current projects with &lt;code&gt;@import&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;Currently the &lt;code&gt;@use&lt;/code&gt; rule is available in Dart Sass v1.23.0 only. It is not yet available with LibSass (which also means no Node Sass implementation) or Ruby Sass (which has reached its EOL anyhow...RIP 💀). This means that if you would like to start testing out the &lt;code&gt;@use&lt;/code&gt; rule, you will need to convert your project to use Dart Sass if it does not already. I mostly work in Angular, and since the v8.0.0 release Angular now uses Dart Sass, where before it was just an option. Dart Sass is also the primary implementation of Sass, which means if you want all of the shiny new features you should make the switch. Outside of that, the only hiccup that I ran into is that the extensions I use in VSCode do not currently know how to handle the &lt;code&gt;@use&lt;/code&gt; (and subsequently the &lt;code&gt;@forward&lt;/code&gt;) rules when written in the editor.&lt;/p&gt;

&lt;p&gt;For larger projects this can be quite the undertaking to switch all of the import statements to utilize the new &lt;code&gt;@use&lt;/code&gt; rule. Never fear, you can install the &lt;a href="https://www.npmjs.com/package/sass-migrator"&gt;sass-migrator package&lt;/a&gt; from NPM which will help do some of the heavy lifting here.&lt;/p&gt;

&lt;p&gt;There is also plenty of time to do this so that you can slowly switch over your imports to this new module system over time. The Sass team has made it clear that they have taken into consideration the effort that would be needed to change products over to this. The new module system is backwards-compatible between &lt;code&gt;@import&lt;/code&gt; and &lt;code&gt;@use&lt;/code&gt;, and nothing has been deprecated or removed just yet. According to their &lt;a href="http://sass.logdown.com/posts/7858341-the-module-system-is-launched"&gt;recent blog post&lt;/a&gt; here is the timeframe and/or criteria that needs to be met prior to deprecation and removal of the current system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deprecated:&lt;/strong&gt;  This will be done after &lt;code&gt;@use&lt;/code&gt; has been supported in Dart Sass and LibSass for one year or two years after Dart Sass launches support for &lt;code&gt;@use&lt;/code&gt; (which it has). This will happen no later than October 1st, 2021.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Support dropped and/or removed:&lt;/strong&gt;  This will happen one year after deprecation goes into effect. This will occur no later than October 1st 2022.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means that there will be, at the very least, two to three more years of support for &lt;code&gt;@import&lt;/code&gt; to be used alongside &lt;code&gt;@use&lt;/code&gt; while you convert your applications over.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to implement the &lt;code&gt;@use&lt;/code&gt; rule
&lt;/h2&gt;

&lt;p&gt;In the next few parts we will take a look at how &lt;code&gt;@use&lt;/code&gt; solves some of the issues that exist with &lt;code&gt;@import&lt;/code&gt; and provide some more functionality and control when working with modules.&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>todayilearned</category>
    </item>
  </channel>
</rss>
