Coder Social home page Coder Social logo

stylelint-config-zcs's Introduction

styleint 配置插件

安装

npm install --save-dev stylelint-config-zcs stylelint-a11y stylelint-config-prettier stylelint-no-unsupported-browser-features

使用

创建.stylelintrc.js,放到根目录,内容如下:

module.exports = {
  extends: 'stylelint-config-zcs',
};

集成 webpack

在预处理器 loader(less,sass)和 css-loader 之间添加 postcss-loader,插件使用 stylelint

代码类似:

use: [
  // 抽象的css-loader
  modular({ prevLoader: 2, isUseSourceMap: true }),
  // postcss-loader集成stylelint
  {
    loader: require.resolve('postcss-loader'),
    options: {
      ident: 'postcss',
      plugins: () => [require('stylelint')()],
    },
  }
  // 抽象的预处理器loader(less,sass)
  cssCompile({ isUseSourceMap: true })
]

集成 vscode

安装拓展 stylelint

规范文档

文档地址

约束范围

  1. css 错误语法
  2. css 功能限制
  3. css 样式 - (配合 prettier:先 prettier 格式化,剩下的进行检查)
  4. css 可访问性
  5. 根据 browserslist 检查浏览器兼容性

可用功能

检查是否最新规则

npm run checkRule

生成文档

npm run createDoc

stylelint-config-zcs's People

Contributors

zcs19871221 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.