使用Tailwind-CSS时,如何摆脱这些SASS掉毛错误? [英] How do you get rid of these SASS linting errors when using Tailwind-CSS?

查看:827
本文介绍了使用Tailwind-CSS时,如何摆脱这些SASS掉毛错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在Gatsby.js项目中使用Tailwind。我的环境是VSCode,使用的是Prettier代码格式化程序。



我如何摆脱这些掉毛的错误警报?

解决方案

.css和.scss的解决方案




  1. 在项目的根目录下,使用文件 settings.json .vscode c>:



< ol start = 2>
  • 将以下内容添加到 .vscode / settings.json:



  •   {
    css.validate:否,
    less.validate:否,
    scss.validate:false
    }




    1. 安装


      1. 安装


        I'm using Tailwind in a Gatsby.js project. My environment is VSCode, using Prettier code formatter.

        How do I get rid of these linting error alerts?

        解决方案

        Solution for both .css and .scss

        1. At the root level of your project, update or create a dir .vscode with a file settings.json:

        1. Add the following to .vscode/settings.json:

        {
          "css.validate": false,
          "less.validate": false,
          "scss.validate": false
        }
        

        1. Install the vscode-stylelint extension

        1. install stylelint-config-standard:

        npm i stylelint-config-standard -D

        1. create a stylelint.config.js file at the root level and add:

        module.exports = {
          extends: ['stylelint-config-recommended'],
          rules: {
            "at-rule-no-unknown": [
              true,
              {
                ignoreAtRules: [
                  "tailwind",
                  "apply",
                  "variants",
                  "responsive",
                  "screen",
                ],
              },
            ],
            "declaration-block-trailing-semicolon": null,
            "no-descending-specificity": null,
          },
        };
        

        1. restart vsCode

        Results:

        You get rid of these SASS linting errors when using Tailwind-CSS and keep doing css validation with stylelint.

        这篇关于使用Tailwind-CSS时,如何摆脱这些SASS掉毛错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆