npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stylelint-theme-variable-plugins

v0.0.9

Published

stylelint检测项目中样式文件变量使用情况插件,项目中如果设置了通用变量,可以通过它来实现项目中样式的文件对变量的实施情况,检测到变量中的值会提醒开发者应该调用变量,而非直接使用值

Downloads

43

Readme

简介

本插件基于stylelint,项目中如果设置了通用变量,可以通过它来实现项目中样式的文件对变量的实施情况,检测到变量中的值会提醒开发者应该调用变量,而非直接使用值。从而实现通过变量控制项目中的整体样式。

安装

npm安装

npm i stylelint stylelint-theme-variable-plugins -D

yarn安装

yarn add stylelint stylelint-theme-variable-plugins -D

使用

在项目根目录中新建.stylelintrc.js文件,并加入如下代码。 其中theme为你项目中的样式变量,一般应该是less或sass,由于插件只能接收对象,所以这里建议通过脚本生成less或sass及json文件使变量内容能对应上。

const theme = require('./src/assets/theme/default.json');

module.exports = {
  "ignoreFiles": ["src/assets/less/**/*.less"],
  "plugins": ["stylelint-theme-variable-plugins"],
  "extends": "stylelint-theme-variable-plugins/config",
  "rules": {
    "stylelint-check/props-variable-use": {
      "theme": theme,
    },
  }
}

参数

| 参数 | 数据类型 | 说明 | 默认值 | 必填 | 例子 | |---|---|---|---|---|---| | theme | object | 变量的键值对对象 | null | 是 | { primary: '#1890ff' } | | color-props-check | string('off | on') | 是否开启颜色属性检查 | 'on' | 否 |
| size-props-check | string('off | on') | 是否开启尺寸属性检查 | 'on' | 否 | | space-props-check | string('off | on') | 是否开启间距属性检查 | 'on' | 否 | | severity | string('error' | 'warning' | 'ignore') | 发现问题后的状态 | 'warning' | 否 |

使用命令行检测单个文件

1. 全局安装styelint

npm i stylelint -g

2. 执行命令

stylelint path/to/your.less --formatter unix