<?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: smilelk4</title>
    <description>The latest articles on DEV Community by smilelk4 (@smilelk4).</description>
    <link>https://dev.to/smilelk4</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%2F855960%2Fe7c0924a-51fd-44c0-8fe7-94ef6d4d75b7.png</url>
      <title>DEV Community: smilelk4</title>
      <link>https://dev.to/smilelk4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/smilelk4"/>
    <language>en</language>
    <item>
      <title>Auto-Format Stylesheet On Save Using WebStorm with 3 Steps</title>
      <dc:creator>smilelk4</dc:creator>
      <pubDate>Sat, 04 Jun 2022 14:40:58 +0000</pubDate>
      <link>https://dev.to/smilelk4/auto-format-stylesheet-on-save-using-webstorm-with-3-steps-5fi5</link>
      <guid>https://dev.to/smilelk4/auto-format-stylesheet-on-save-using-webstorm-with-3-steps-5fi5</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Linter tools can help keep code clean and consistent, but can get annoying if the issues aren't caught until committing or pushing to remote repository. This article is to omit such pain by utilizing Stylelint.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LXxQTrf2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mdmbvzxxfpt8z1hg9xoq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LXxQTrf2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mdmbvzxxfpt8z1hg9xoq.png" alt="Linter complaining" width="174" height="176"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The author used SCSS as the stylesheet format, but the same idea is also applicable with other formats like CSS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Mac&lt;/li&gt;
&lt;li&gt;WebStorm&lt;/li&gt;
&lt;li&gt;SCSS&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Download dependencies
&lt;/h2&gt;

&lt;p&gt;If using npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i stylelint stylelint-config-standard-scss -D
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If using yarn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add stylelint stylelint-config-standard-scss -D
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. .stylelintrc
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;.stylelintrc.json&lt;/code&gt; at the root of the project, and add below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "extends": "stylelint-config-standard-scss"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Setting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go into Webstorm &amp;gt; Preferences&lt;/li&gt;
&lt;li&gt;Under Tools &amp;gt; File Watchers:

&lt;ul&gt;
&lt;li&gt;Click &lt;code&gt;+&lt;/code&gt; to create new&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;SCSS&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Set up the configs as below:
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--36D88bXU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8hkvkbkz1jmteezwfosz.png" alt="File Watcher configs" width="880" height="391"&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;File type: SCSS style sheet&lt;/li&gt;
&lt;li&gt;Scope: Project Files&lt;/li&gt;
&lt;li&gt;Program: &lt;code&gt;/&amp;lt;PATH_TO_PROJECT&amp;gt;/node_modules/stylelint/bin/stylelint.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Arguments: &lt;code&gt;$FileName$ --fix&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Output paths to refresh: &lt;code&gt;$FileName$&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;...and see the lint in action as you save your stylesheet 🎉🎉🎉&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LlTRXDzK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxwo5gpubjyc88w7ojc9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LlTRXDzK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxwo5gpubjyc88w7ojc9.gif" alt="Image description" width="434" height="184"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Linter for stylesheet:&lt;br&gt;
&lt;a href="https://stylelint.io/"&gt;stylelint&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The standard shareable SCSS config for Stylelint:&lt;br&gt;
&lt;a href="https://github.com/stylelint-scss/stylelint-config-standard-scss"&gt;stylelint-config-standard-scss&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>jetbrains</category>
      <category>linter</category>
      <category>scss</category>
    </item>
  </channel>
</rss>
