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

csslint-qmui

v0.10.3

Published

CSSLint for QMUI

Downloads

3

Readme

npm version Build Status Dependency Status devDependency Status

CSSLint-QMUI

基于 CSSLint 增加了适用于 QMUI 规范的检测规则,用于快速检测新人常见的,不符合 QMUI 命名规范的 Class-name 命名问题。

Class-name Formats(Class-name 格式检测)

检测条件包括以下两条:

  1. Class-name 只能由 a-z, A-Z, 1-9(不能为0)和下划线(-)这些字符构成
  2. Class-name 中至少包括一个下划线(-)

配合 CSSLint 原有的检测条件以及 W3C 的规范,最终得出合符条件的 Class-name,例如有以下样式表:

.test {
  background: red;
}
.test-qmui {
  background: blue;
}
.test_qmui {
  background: yellow;
}
.zero_qmui0 {
  background: yellow;
}

检测后得出如下结果:

csslint: There are 3 problems in /Users/Kayo/Web/main.css.

main.css
1: warning at line 1, col 1
Class-name should consists of two parts at least.
.test {

main.css
2: warning at line 4, col 1
Naming format does not follow the norm QMUI(Just a-z, A-Z, 1-9 and _).
.test-qmui {

main.css
3: warning at line 10, col 1
Naming format does not follow the norm QMUI(Just a-z, A-Z, 1-9 and _).
.zero_qmui0 {

适应的常见问题:

  • 使用中划线(-)作为连接符
  • Class-name 只由一个部分组成。(说明:为了避免 Class-name 过于简单造成 CSS 污染,QMUI 规范中规定 Class-name 至少应由两部分组成,每个部分是一个单词或者单词的缩写或者结合数字,连接符使用下划线(_))

Miss Root Class(缺少 Root Class)

检测一个 Class-name 是否有写 Root Class,例如有如下样式表:

.test_list {
    background: yellow;
}
.test_list_item {
    background: yellow;
}
.test_head_title {
    font-size: 20px;
}

检测后得出如下结果:

csslint: There is 1 problem in /Users/Kayo/Web/main.css.

main.css
main.css
1: warning at line 7, col 1
Class-name .test_head_title shouldn't exist unless you've already set a class-name .test_head.
.test_head_title {

.test_list_item 因为已经正确地同时定义了 Root Class .test_list,因此没有报错。而.test_head_title则因为缺少 Root Class 而报 Warning 了。

适应的常见问题:

  • 没有正确理解 Root Class 与 CSS 命名空间的概念,如直接定义子 Class,而没有先定义 Root Class,再一步步定义子 Class
  • 创建扩展 Class-name 时没有先定义基类