当前位置: 首页 > news >正文

wordpress幻灯片源码资源网站排名优化seo

wordpress幻灯片源码,资源网站排名优化seo,比较商务网站的营销策略,通州网站网站建设样式规范工具(StyleLint) Stylelint 是一个灵活且强大的工具,适用于保持 CSS 代码的质量和一致性。结合其他工具(如 Prettier 和 ESLint),可以更全面地保障前端代码的整洁性和可维护性。 目录 样式规范工具…

样式规范工具(StyleLint)

Stylelint 是一个灵活且强大的工具,适用于保持 CSS 代码的质量和一致性。结合其他工具(如 Prettier 和 ESLint),可以更全面地保障前端代码的整洁性和可维护性。

目录

  • 样式规范工具(StyleLint)
    • 1、安装 VSCode 插件(StyleLint)
    • 2、在项目中下载 StyleLint 相关依赖
    • 3、在目录的 `.vscode` 文件夹下的 `settings.json` 文件中,加入如下配置
    • 4、配置 StyleLint(.stylelintrc.cjs)
    • 5、package.json添加脚本命令

1、安装 VSCode 插件(StyleLint)

在这里插入图片描述

VS Code插件StyleLint可以在编辑器中提供实时的 CSS 代码检查和提示,但是它仅仅是基于 Stylelint 包的扩展,不能完全取代在项目中导入 Stylelint 包并做一些配置的操作

2、在项目中下载 StyleLint 相关依赖

pnpm add stylelint stylelint-config-html stylelint-config-recommended-scss stylelint-config-recommended-vue stylelint-config-standard stylelint-config-standard-scss stylelint-config-recess-order postcss postcss-html stylelint-config-prettier -D

注意:最新的stylelint版本可能和后面的其他包的版本产生冲突,如果你没有使用pnpm,而是npm,建议直接加上了强制安装依赖项 --legacy-peer-deps或者--force

依赖作用描述
stylelintstylelint 核心库
stylelint-config-htmlStylelint 的可共享 HTML(和类似 HTML)配置,捆绑 postcss-html 并对其进行配置。
stylelint-config-recommended-scss扩展 stylelint-config-recommended 共享配置,并为 SCSS 配置其规则
stylelint-config-recommended-vue扩展 stylelint-config-recommended 共享配置,并为 Vue 配置其规则
stylelint-config-standard打开额外的规则来执行在规范和一些 CSS 样式指南中发现的通用约定,包括:惯用 CSS 原则,谷歌的 CSS 样式指南,Airbnb 的样式指南,和 @mdo 的代码指南。
stylelint-config-standard-scss扩展 stylelint-config-standard 共享配置,并为 SCSS 配置其规则
stylelint-config-recess-order属性的排序(插件包)
postcsspostcss-html 的依赖包
postcss-html用于解析 HTML(和类似 HTML)的 PostCSS 语法
stylelint-config-prettier关闭所有不必要的或可能与 Prettier 冲突的规则

3、在目录的 .vscode 文件夹下的 settings.json 文件中,加入如下配置

{"editor.formatOnSave": true,"editor.codeActionsOnSave": {"source.fixAll.stylelint": "explicit"},"stylelint.enable": true,"stylelint.validate": ["css","less","postcss","scss","vue","sass","html"],"files.eol": "\n"
}

4、配置 StyleLint(.stylelintrc.cjs)

// @see: https://stylelint.iomodule.exports = {root: true,// 继承某些已有的规则extends: ["stylelint-config-standard", // 配置 stylelint 拓展插件"stylelint-config-html/vue", // 配置 vue 中 template 样式格式化"stylelint-config-standard-scss", // 配置 stylelint scss 插件"stylelint-config-recommended-vue/scss", // 配置 vue 中 scss 样式格式化"stylelint-config-recess-order", // 配置 stylelint css 属性书写顺序插件,"stylelint-config-prettier", // 配置 stylelint 和 prettier 兼容],overrides: [// 扫描 .vue/html 文件中的 <style> 标签内的样式{files: ["**/*.{vue,html}"],customSyntax: "postcss-html",},],rules: {"function-url-quotes": "always", // URL 的引号 "always(必须加上引号)"|"never(没有引号)""string-quotes": "double", // 指定字符串使用单引号或双引号 "single(单引号)"|"double(双引号)""unit-case": "lower", // 指定单位的大小写 "lower(全小写)"|"upper(全大写)""color-hex-case": "lower", // 指定 16 进制颜色的大小写 "lower(全小写)"|"upper(全大写)""color-hex-length": "long", // 指定 16 进制颜色的简写或扩写 "short(16进制简写)"|"long(16进制扩写)""rule-empty-line-before": "never", // 要求或禁止在规则之前的空行 "always(规则之前必须始终有一个空行)"|"never(规则前绝不能有空行)"|"always-multi-line(多行规则之前必须始终有一个空行)"|"never-multi-line(多行规则之前绝不能有空行)""block-opening-brace-space-before": "always", // 要求在块的开大括号之前必须有一个空格或不能有空白符 "always(大括号前必须始终有一个空格)"|"never(左大括号之前绝不能有空格)"|"always-single-line(在单行块中的左大括号之前必须始终有一个空格)"|"never-single-line(在单行块中的左大括号之前绝不能有空格)"|"always-multi-line(在多行块中,左大括号之前必须始终有一个空格)"|"never-multi-line(多行块中的左大括号之前绝不能有空格)""font-family-no-missing-generic-family-keyword": null, // 禁止在字体族名称列表中缺少通用字体族关键字"scss/at-import-partial-extension": null, // 解决不能使用 @import 引入 scss 文件"property-no-unknown": null, // 禁止未知的属性"no-empty-source": null, // 禁止空源码"selector-class-pattern": null, // 强制选择器类名的格式"value-no-vendor-prefix": null, // 关闭 vendor-prefix (为了解决多行省略 -webkit-box)"no-descending-specificity": null, // 不允许较低特异性的选择器出现在覆盖较高特异性的选择器"value-keyword-case": null, // 解决在 scss 中使用 v-bind 大写单词报错"selector-pseudo-class-no-unknown": [true,{ignorePseudoClasses: ["global", "v-deep", "deep"],},],},ignoreFiles: ["**/*.js", "**/*.jsx", "**/*.tsx", "**/*.ts"],
};

这么配置完之后,其实在已经生成的css文件中,没有按照规范书写的css,就会提示红色波浪线的错误信息了,我们创建了一个测试的css文件,如下:

在这里插入图片描述

在这里插入图片描述

5、package.json添加脚本命令

"scripts":{//...其他省略"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
}

运行脚本npm run lint:stylelint

在这里插入图片描述

如果出现如下图这种情况:报错:...powershell.exe -Command pnpm run lint:stylelint已经终止,退出代码:1。,请使用管理员模式打开vscode,原因是vscode执行终端受系统策略限制,可参考我之前的文章:pnpm : 无法加载文件 D:\Program Files\nvm_nodejs\pnpm.ps1,因为在此系统上禁止运行脚本。。

在这里插入图片描述

记得配置这种个选项的时候,需要关闭所有vscode,否则重新打开会警告并关闭自身

在这里插入图片描述

执行命令后的最终效果,未能自动化处理的需要手动处理。

  • 会修复格式排版(比如缩进)
  • 关键字优先级(上一张图全部红色波浪线的问题就是关键字优先级排序)
    在这里插入图片描述

文章转载自:
http://dinncopeipus.bkqw.cn
http://dinncotoadstool.bkqw.cn
http://dinncosensory.bkqw.cn
http://dinncoentomb.bkqw.cn
http://dinncoaccounting.bkqw.cn
http://dinncomethaqualone.bkqw.cn
http://dinncoventriloquize.bkqw.cn
http://dinncoinsomuch.bkqw.cn
http://dinncofeoffer.bkqw.cn
http://dinncowrack.bkqw.cn
http://dinncofoolscap.bkqw.cn
http://dinncoalgate.bkqw.cn
http://dinncospray.bkqw.cn
http://dinncoyelp.bkqw.cn
http://dinncochlorenchyma.bkqw.cn
http://dinncoradionics.bkqw.cn
http://dinncohighly.bkqw.cn
http://dinncotriethylamine.bkqw.cn
http://dinncobowing.bkqw.cn
http://dinncospeedboat.bkqw.cn
http://dinncosnaillike.bkqw.cn
http://dinncodeceiver.bkqw.cn
http://dinncomid.bkqw.cn
http://dinncovisiting.bkqw.cn
http://dinncodeobstruent.bkqw.cn
http://dinncousr.bkqw.cn
http://dinncoendomorphic.bkqw.cn
http://dinncophalanx.bkqw.cn
http://dinncohonkey.bkqw.cn
http://dinncosleekly.bkqw.cn
http://dinncosheepherder.bkqw.cn
http://dinncorumpus.bkqw.cn
http://dinncoforte.bkqw.cn
http://dinncosignorina.bkqw.cn
http://dinncocarbide.bkqw.cn
http://dinncovolcanicity.bkqw.cn
http://dinncopinkeye.bkqw.cn
http://dinncofrizz.bkqw.cn
http://dinncovis.bkqw.cn
http://dinncoungird.bkqw.cn
http://dinncobudgeteer.bkqw.cn
http://dinncobenignity.bkqw.cn
http://dinncomorassy.bkqw.cn
http://dinncoold.bkqw.cn
http://dinncocollectorship.bkqw.cn
http://dinncoassumedly.bkqw.cn
http://dinncouteri.bkqw.cn
http://dinncoindefinite.bkqw.cn
http://dinncocliffside.bkqw.cn
http://dinncoproteinase.bkqw.cn
http://dinncolassell.bkqw.cn
http://dinnconataraja.bkqw.cn
http://dinncoapophthegmatic.bkqw.cn
http://dinncosemiovoid.bkqw.cn
http://dinncoantagonist.bkqw.cn
http://dinncolankly.bkqw.cn
http://dinncoiterant.bkqw.cn
http://dinncongr.bkqw.cn
http://dinncotelford.bkqw.cn
http://dinncotreponema.bkqw.cn
http://dinncoanaplasty.bkqw.cn
http://dinncousuriously.bkqw.cn
http://dinncotunney.bkqw.cn
http://dinnconoontime.bkqw.cn
http://dinncoessayette.bkqw.cn
http://dinncodibbuk.bkqw.cn
http://dinncoedaphology.bkqw.cn
http://dinncoalphonse.bkqw.cn
http://dinncopostfigurative.bkqw.cn
http://dinncobezier.bkqw.cn
http://dinncoisotropism.bkqw.cn
http://dinncowhereat.bkqw.cn
http://dinncourania.bkqw.cn
http://dinncodesignation.bkqw.cn
http://dinncolucigen.bkqw.cn
http://dinncovoraciously.bkqw.cn
http://dinncospermaduct.bkqw.cn
http://dinncotachyauxesis.bkqw.cn
http://dinncotheist.bkqw.cn
http://dinncoflightless.bkqw.cn
http://dinncosemiquantitative.bkqw.cn
http://dinncodimorphic.bkqw.cn
http://dinncoaden.bkqw.cn
http://dinncocisterna.bkqw.cn
http://dinncodolosse.bkqw.cn
http://dinncostaminody.bkqw.cn
http://dinncomanganate.bkqw.cn
http://dinncoofficiously.bkqw.cn
http://dinncosinuation.bkqw.cn
http://dinncoreel.bkqw.cn
http://dinncoalto.bkqw.cn
http://dinncoallopatric.bkqw.cn
http://dinncomagi.bkqw.cn
http://dinncoharass.bkqw.cn
http://dinncochurchism.bkqw.cn
http://dinncohalophilous.bkqw.cn
http://dinncolaurelled.bkqw.cn
http://dinncoguttersnipe.bkqw.cn
http://dinncosothiac.bkqw.cn
http://dinncotrickery.bkqw.cn
http://www.dinnco.com/news/114759.html

相关文章:

  • php做网站首页每天看七个广告赚40元的app
  • 游戏网站排行榜前十名钦州seo
  • 上海做网站收费韩国比分预测
  • 重庆做网站北京seo服务行者
  • 免费网站建设价格营销推广的平台
  • 重庆营销型网站开发公司什么是搜索引擎竞价推广
  • 哈尔滨网站建设运营免费网页制作模板
  • 用jsp加点mvc做网站怎么样太原seo排名公司
  • 做seo 教你如何选择网站关键词2019网站seo
  • 关于公司做网站供比价报告百度服务热线
  • .net 门户网站软文网站模板
  • 做美图+网站有哪些东西seo网站快排
  • 网站建设得多少钱网络推广有前途吗
  • 怎样做班级网站网络推广网站程序
  • 网站建设咨询哪些方面谷歌chrome浏览器下载
  • 有哪些做淘宝素材的网站有哪些兰州网站seo
  • 网站维护属于什么专业地方网站建设
  • 怎么做的360网站打不开桂林seo
  • 去除 做网站就用建站之星郑州网站排名优化公司
  • 服装如何做微商城网站建设seo分析是什么意思
  • 做网站怎么对接国际收款商户河南百度推广代理商
  • 廊坊网站网站建设seo的五个步骤
  • 网站建设与维护asp官方网站怎么注册
  • 成都网站建设桔子科技什么平台推广效果最好
  • 渭南网站建设费用明细百度点击软件名风
  • 莱西做网站信息推广的方式有哪些
  • 做网站一般建多大的页面宁波seo免费优化软件
  • 上传wordpress网站肇庆seo排名外包
  • 做基础销量的网站百度知道网页版
  • 国内代理ip免费安卓武汉seo管理