stylelint_你好Stylelint

news/2024/7/19 13:02:20 标签: python, java, vue, js, javascript
stylelint

stylelint

Stylelint is a great new modern unopinionated CSS linter. It's a must for any project beyond test.html.

Stylelint是一款很棒的新型现代无污染CSS短绒。 对于test.html以外的任何项目,这都是必须的。

After my last post about always adding generic font families I thought it should be a lint-able thing. So I looked into extending Stylelint. You can write new lint rules and tell Stylelint to use them. In my case, I thought requiring generic font families was broad enough that it should probably be a part of Stylelint core.

在上一篇关于总是添加通用字体系列的文章之后,我认为这应该是一件轻而易举的事情。 因此,我研究了扩展Stylelint的方法。 您可以编写新的皮棉规则,并告诉Stylelint使用它们。 就我而言,我认为要求通用字体系列足够广泛,以至于它应该成为Stylelint核心的一部分。

在您的项目中运行Stylelint (Running Stylelint in your project)

Installing Stylelint is actually not required in order to contribute a new rule, but hey!

为了贡献新规则,实际上不需要安装Stylelint,但是,嘿!

As one would expect in this day and age..

正如今天所期望的那样。

$ npm install -g stylelint

Running Stylelint requires a config. Remember, it's unopinionated, you have to express your opinion. I think the best place to start is using the example config which is actually a separate project, stylelint-config-standard

运行Stylelint需要配置。 请记住,这是没有意见的,您必须表达自己的意见。 我认为最好的起点是使用示例配置,它实际上是一个单独的项目, stylelint-config-standard

$ cd /your/project/root
$ curl https://raw.githubusercontent.com/stylelint/stylelint-config-standard/master/index.js > styelint.config.js

And now, linting...

现在,棉绒...

$ stylelint src/*.css

Oh boy, a new todo!

哦,男孩,一个新的待办事项!

running stylelint

在任何旧CSS上运行Stylelint (Running Stylelint on any old CSS)

If you're like me, you have a lot of stuff all over the place. Not necessarily nicely setup as a project with a build script and all that. I want to lint a CSS no matter where it may reside.

如果您像我,那么到处都有很多东西。 不一定很好地将其设置为带有构建脚本的项目。 无论它可能驻留在哪里,我都希望为CSS添加绒毛。

So a globaly accessible config is in order. (Stylelint CLI itself is already global.) One that doesn't have dependencies.

因此,全局可访问配置是适当的。 (Stylelint CLI本身已经是全局的。)一个没有依赖项的。

cd ~/

# same as above, grab the "standard" config
$ curl https://raw.githubusercontent.com/stylelint/stylelint-config-standard/master/index.js > styelint.config.js

The "standard" config depends on the "recommended", so I just grab the rules from it and paste them in styelint.config.js. In effect I merely inline the dependency. My styelint.config.js now looks like...

“标准”配置取决于“推荐”,因此我只是从中获取规则并将其粘贴到styelint.config.js 。 实际上,我只是内联依赖项。 我的styelint.config.js现在看起来像...

"use strict"

module.exports = {
  "rules": {
    "at-rule-no-unknown": true,
    "block-no-empty": true,
    "color-no-invalid-hex": true,
....

Now I can run $ stylelint whatevs.css no matter if whatevs.css is part of any specific setup or just cluttering the Desktop.

现在,无论whatevs.css是任何特定设置的一部分,还是只是使桌面混乱,我都可以运行$ stylelint whatevs.css

Tell your friends about this post on Facebook and Twitter

在Facebook和Twitter上告诉您的朋友有关此帖子的信息

翻译自: https://www.phpied.com/hello-stylelint/

stylelint


http://www.niftyadmin.cn/n/1305936.html

相关文章

Eclipse设置内存大小

Eclipse设置内存大小 1、修改Eclipse的配置文件 (1)打开Eclipse目录 (2)以EditPlus打开eclipse.ini,修改“-Xms40m -Xmx512m”成“-Xms512m -Xmx512m” 2、修改JDK内存 (1)双击打开eclipse&am…

字体摆弄

Ive been trying to stay away from webfonts as much as I can. IMO they are not worth the performance complications. Font loaders, FOUT, yadda-yadda. But... it happens. 我一直在尝试尽可能远离webfonts。 海事组织他们不值得表现复杂。 字体加载器,FOUT…

webaudio_WebAudio Deep Note,第4部分:多种声音

webaudioPreviously in this series: 本系列之前的内容: intro 介绍play a sound 播放声音 2.1. kick and snare (a fun distraction from the main series)2.1。 踢和圈套(主系列有趣的干扰)play a sound 播放声音 loop and change pitch循环并改变音高We need t…

间隔时间计算公式_间隔

间隔时间计算公式Heres my new tool called intervals 这是我称为间隔的新工具 Play with it here. 在这里玩。 Learn about the theory behind it here. 在这里了解背后的理论。 The code for the tool. 该工具的代码。 它有什么作用? (What does it do?) Genera…

eclipse中的System.getProperty(user.dir)

eclipse中的System.getProperty("user.dir") 1、在Java Application中,上述中的获取的是Java项目的路径 (1)运行源码 /*** */ package com.you.test;/*** author YouHaiDong**/ public class Property {/*** param args*/public …

Java Breakpoint

1、错误描述 Java Breakpoint Unable to install breakpoint in com.you.humb.web.commom.dao.impl.ExportDaoImpl$ $EnhancerByCGLIB$$9e9175d5 due to missing line number attributes.Modify compiler options to generate line number attributes. 2、错误原因 3、解决办法…

WebAudio Deep Note,第5部分:节点

Previously on "Deep Note via WebAudio": 以前在“通过WebAudio进行深度注释”中: intro 介绍play a sound 播放声音 2.1. boots and cats2.1。 靴子和猫play a sound 播放声音 loop and change pitch循环并改变音高multiple sounds多种声音节点数(Node…

java.lang.OutOfMemoryError:Java heap space

1、错误描述 (mx.messaging.messages:ErrorMessage)#0 body (null) clientId "82C12FAA-ED2A-16A4-4FEA-720F521A5727" extendedData (null) faultCode "Server.Processing" faultDetail (null) faultString "java.lang.OutOfMemoryError:Java …