Vuepress 2从0-1保姆级进阶教程——标准化流程

2024-06-08 07:04

本文主要是介绍Vuepress 2从0-1保姆级进阶教程——标准化流程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在这里插入图片描述

Vuepress 2 专栏目录

1. 入门阶段

  1. Vuepress 2从0-1保姆级入门教程——环境配置篇
  2. Vuepress 2从0-1保姆级入门教程——安装流程篇
  3. Vuepress 2从0-1保姆级入门教程——文档配置篇
  4. Vuepress 2从0-1保姆级入门教程——范例与部署

2.进阶阶段

  1. Vuepress 2从0-1保姆级进阶教程——全文搜索篇
  2. Vuepress 2从0-1保姆级进阶教程——美化与模版
  3. Vuepress 2从0-1保姆级进阶教程——标准化流程

一、样式

如果你专注写作,请跳过样式

(一)Autoprefixer(推荐)

css3有些功能写法没统一下来, 各个浏览器写法不同,比如写个动画延时,考虑到兼容问题,要这样写:

.test{-moz-animation-delay:.3s;-webkit-animation-delay:.3s;-o-animation-delay: .3s;animation-delay: .3s;
}

Autoprefixer是一个用于添加浏览器前缀的工具,在代码打包后自动运行

1.安装

pnpm install autoprefixer -D

在这里插入图片描述

2.配置

import autoprefixer from 'autoprefixer'export default defineUserConfig({plugins: [autoprefixer({overrideBrowserslist: ['Chrome > 40', 'ff > 31', 'ie 11'],})
],bundler: viteBundler(),
})

在这里插入图片描述

pnpm docs:build后,在dist/assets查看样式文件,可看到添加的浏览器前缀

在这里插入图片描述

(二)TailwindCSS(可选)

TailwindCSS依赖Autoprefixer,请确保安装过Autoprefixer

pnpm install -D tailwindcss postcss
npx tailwindcss init -p

1.初始化配置

安装后会在项目根目录生成tailwind.config.js,postcss.config.js配置文件
编辑tailwind.config.js

/** @type {import('tailwindcss').Config} */
export default {content: ["./index.html","./docs/**/*.{js,ts,jsx,tsx}",],theme: {extend: {},},plugins: [],
}

2.样式调用

在.vuepress/styles/index.scss调用

@tailwind base;
@tailwind components;
@tailwind utilities;

二、Commit

是不是经常发现自己推送的commit不知道做了啥,Changelog不想写?随便一写,后面版本更迭,摸不到头脑,用以下工具更好的帮你

(一)cz-git

在这里插入图片描述

1.安装

pnpm install -D commitizen cz-git

2.修改package.json

添加以下内容指定适配器,并单独调用git-cz取代git commit

  "scripts": {"docs:build": "vuepress build docs","docs:clean-dev": "vuepress dev docs --clean-cache","docs:dev": "vuepress dev docs","docs:update-package": "pnpm dlx vp-update","commit":"git add . && git-cz"},"config": {"commitizen": {"path": "node_modules/cz-git"}},

3.配置模版

根目录新建commitlint.config.cjs(esm规范项目)

// commitlint.config.cjs
/** @type {import('cz-git').UserConfig} */
module.exports = {rules: {// @see: https://commitlint.js.org/#/reference-rules},prompt: {alias: { fd: 'docs: fix typos' },messages: {type: '选择你要提交的类型 :',scope: '选择一个提交范围(可选):',customScope: '请输入自定义的提交范围 :',subject: '填写简短精炼的变更描述 :\n',body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',footerPrefixesSelect: '选择关联issue前缀(可选):',customFooterPrefix: '输入自定义issue前缀 :',footer: '列举关联issue (可选) 例如: #31, #I3244 :\n',confirmCommit: '是否提交或修改commit ?'},types: [{ value: 'feat', name: 'feat:     新增功能 | A new feature' },{ value: 'fix', name: 'fix:      修复缺陷 | A bug fix' },{ value: 'docs', name: 'docs:     文档更新 | Documentation only changes' },{ value: 'style', name: 'style:    代码格式 | Changes that do not affect the meaning of the code' },{ value: 'refactor', name: 'refactor: 代码重构 | A code change that neither fixes a bug nor adds a feature' },{ value: 'perf', name: 'perf:     性能提升 | A code change that improves performance' },{ value: 'test', name: 'test:     测试相关 | Adding missing tests or correcting existing tests' },{ value: 'build', name: 'build:    构建相关 | Changes that affect the build system or external dependencies' },{ value: 'ci', name: 'ci:       持续集成 | Changes to our CI configuration files and scripts' },{ value: 'revert', name: 'revert:   回退代码 | Revert to a commit' },{ value: 'chore', name: 'chore:    其他修改 | Other changes that do not modify src or test files' },],useEmoji: false,emojiAlign: 'center',useAI: false,aiNumber: 1,themeColorCode: '',scopes: [],allowCustomScopes: true,allowEmptyScopes: true,customScopesAlign: 'bottom',customScopesAlias: 'custom',emptyScopesAlias: 'empty',upperCaseSubject: false,markBreakingChangeMode: false,allowBreakingChanges: ['feat', 'fix'],breaklineNumber: 100,breaklineChar: '|',skipQuestions: [],issuePrefixes: [// 如果使用 gitee 作为开发管理{ value: 'link', name: 'link:     链接 ISSUES 进行中' },{ value: 'closed', name: 'closed:   标记 ISSUES 已完成' }],customIssuePrefixAlign: 'top',emptyIssuePrefixAlias: 'skip',customIssuePrefixAlias: 'custom',allowCustomIssuePrefix: true,allowEmptyIssuePrefix: true,confirmColorize: true,scopeOverrides: undefined,defaultBody: '',defaultIssues: '',defaultScope: '',defaultSubject: ''}
}

4.项目提交

pnpm commit

在这里插入图片描述

在这里插入图片描述

(二)conventional-changelog

发布新版本时,自动更新 CHANGELOG.md 文件,减少手动工作

1.安装

pnpm install -g conventional-changelog-cli

2.修改快捷指令

修改package.json,

  "scripts": {"docs:build": "vuepress build docs","docs:clean-dev": "vuepress dev docs --clean-cache","docs:dev": "vuepress dev docs","docs:update-package": "pnpm dlx vp-update","commit":"git add . && git-cz","changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2"},

3.使用

pnpm changelog

在这里插入图片描述

这篇关于Vuepress 2从0-1保姆级进阶教程——标准化流程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1041476

相关文章

springboot使用Scheduling实现动态增删启停定时任务教程

《springboot使用Scheduling实现动态增删启停定时任务教程》:本文主要介绍springboot使用Scheduling实现动态增删启停定时任务教程,具有很好的参考价值,希望对大家有... 目录1、配置定时任务需要的线程池2、创建ScheduledFuture的包装类3、注册定时任务,增加、删

如何为Yarn配置国内源的详细教程

《如何为Yarn配置国内源的详细教程》在使用Yarn进行项目开发时,由于网络原因,直接使用官方源可能会导致下载速度慢或连接失败,配置国内源可以显著提高包的下载速度和稳定性,本文将详细介绍如何为Yarn... 目录一、查询当前使用的镜像源二、设置国内源1. 设置为淘宝镜像源2. 设置为其他国内源三、还原为官方

Maven的使用和配置国内源的保姆级教程

《Maven的使用和配置国内源的保姆级教程》Maven是⼀个项目管理工具,基于POM(ProjectObjectModel,项目对象模型)的概念,Maven可以通过一小段描述信息来管理项目的构建,报告... 目录1. 什么是Maven?2.创建⼀个Maven项目3.Maven 核心功能4.使用Maven H

将Java项目提交到云服务器的流程步骤

《将Java项目提交到云服务器的流程步骤》所谓将项目提交到云服务器即将你的项目打成一个jar包然后提交到云服务器即可,因此我们需要准备服务器环境为:Linux+JDK+MariDB(MySQL)+Gi... 目录1. 安装 jdk1.1 查看 jdk 版本1.2 下载 jdk2. 安装 mariadb(my

IDEA自动生成注释模板的配置教程

《IDEA自动生成注释模板的配置教程》本文介绍了如何在IntelliJIDEA中配置类和方法的注释模板,包括自动生成项目名称、包名、日期和时间等内容,以及如何定制参数和返回值的注释格式,需要的朋友可以... 目录项目场景配置方法类注释模板定义类开头的注释步骤类注释效果方法注释模板定义方法开头的注释步骤方法注

Python虚拟环境终极(含PyCharm的使用教程)

《Python虚拟环境终极(含PyCharm的使用教程)》:本文主要介绍Python虚拟环境终极(含PyCharm的使用教程),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,... 目录一、为什么需要虚拟环境?二、虚拟环境创建方式对比三、命令行创建虚拟环境(venv)3.1 基础命令3

使用Node.js制作图片上传服务的详细教程

《使用Node.js制作图片上传服务的详细教程》在现代Web应用开发中,图片上传是一项常见且重要的功能,借助Node.js强大的生态系统,我们可以轻松搭建高效的图片上传服务,本文将深入探讨如何使用No... 目录准备工作搭建 Express 服务器配置 multer 进行图片上传处理图片上传请求完整代码示例

python连接本地SQL server详细图文教程

《python连接本地SQLserver详细图文教程》在数据分析领域,经常需要从数据库中获取数据进行分析和处理,下面:本文主要介绍python连接本地SQLserver的相关资料,文中通过代码... 目录一.设置本地账号1.新建用户2.开启双重验证3,开启TCP/IP本地服务二js.python连接实例1.

Python 安装和配置flask, flask_cors的图文教程

《Python安装和配置flask,flask_cors的图文教程》:本文主要介绍Python安装和配置flask,flask_cors的图文教程,本文通过图文并茂的形式给大家介绍的非常详细,... 目录一.python安装:二,配置环境变量,三:检查Python安装和环境变量,四:安装flask和flas

Spring Security基于数据库的ABAC属性权限模型实战开发教程

《SpringSecurity基于数据库的ABAC属性权限模型实战开发教程》:本文主要介绍SpringSecurity基于数据库的ABAC属性权限模型实战开发教程,本文给大家介绍的非常详细,对大... 目录1. 前言2. 权限决策依据RBACABAC综合对比3. 数据库表结构说明4. 实战开始5. MyBA