推荐几个前端开发插件

news/2024/6/15 5:24:38 标签: 前端, json, webpack

提高开发效率

简单的集成到了vue-cli生成的项目上 项目github地址

A Vue.js project

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

For a detailed explanation on how things work, check out the guide and docs for vue-loader.

一、集成validate-commit-msg

管理团队的commit信息

步奏

安装validate-commit-msg
npm i --D validate-commit-msg
添加commit规则
  • 1.根目录添加.vcmrc文件,并添加规则,必须为JSON格式
{
  "types": ["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert"],
  "scope": {
    "required": false,
    "allowed": ["*"],
    "validate": false,
    "multiple": false
  },
  "warnOnFail": false,
  "maxSubjectLength": 100,
  "subjectPattern": ".+",
  "subjectPatternErrorMsg": "subject does not match subject pattern!",
  "helpMessage": "",
  "autoFix": false
}
  • 2.添加到package.json
json">{
  "config": {
    "validate-commit-msg": {
      /* your config here */
    }
  }
}
安装husky,并添加commitmsg命令
npm i --D husky
  • 在package.json中添加"commitmsg": "validate-commit-msg"
{
  "scripts": {
    "commitmsg": "validate-commit-msg"
  }
}

查看validate-commit-msg详情

二、集成stylelint

管理团队css编写规范

步奏

安装stylelint, stylelint-order, stylelint-processor-html, stylelint-scss, stylelint-webpack-plugin
// stylelint-order: 属性顺序插件
// stylelint-processor-htm: 检查html中的<style>便签中的样式
// stylelint-scss: scss语法检测
// stylelint-webpack-plugin: webpack检查插件
npm i stylelint stylelint-order stylelint-processor-html stylelint-scss stylelint-webpack-plugin css-properties-sorting --D
在根目录添加 .stylelintrc文件,添加规则和插件
json">{ 
  "processors": ["stylelint-processor-html"],
  "plugins": [
    "stylelint-order",
    "stylelint-scss"
    ],
  "extends": "css-properties-sorting",
  "rules": {
    "order/order": [
      "custom-properties",
      "declarations"
    ],
    "color-no-invalid-hex": true,
    "unit-no-unknown": true,
    "property-no-unknown": true,
    "selector-pseudo-class-no-unknown": true,
    "selector-pseudo-element-no-unknown": true,
    "at-rule-no-unknown": true,
    "comment-no-empty": true,
    "no-invalid-double-slash-comments": true,
    "number-leading-zero": "always",
    "number-no-trailing-zeros": true,
    "declaration-colon-space-after": "always",
    "declaration-colon-space-before": "never"
  }
}
webpack中添加 stylelint-webpack-plugin
const StyleLintPlugin = require('stylelint-webpack-plugin');
plugins: [
  new StyleLintPlugin({
    files: ['**/*.s?(a|c)ss', '**/*.vue'],
    syntax: 'scss'
  }),
]

查看stylelint详情 查看stylelint-webpack-plugin详情

三、Mock

前后端分离

步奏

安装mockjss
npm i --D mockjs
我在项目中创建了个mock,定义了个 test
const Mock = require('mockjs')
Mock.mock('/test', 'get',
  {
    'userList|1-10': [
      {
        'id|1-10': 2
      }
    ]
  }
)
在src下的App.vue中 引入(通过添加环境变量引入,可以快速切换)
import '../mock'
HelloWord.vue中测试
axios.get('/test')
  .then(res => {
    console.log(res)
  })

查看mockjs详情

四、Sentry

管理生产bug

步奏

在Sentry上创建一个项目获取DNS
在 main.js添加
import Raven from 'raven-js'
import RavenVue from 'raven-js/plugins/vue'
Raven
  .config('https://4ff044c4c2374c359a94d58b2c3e89d5@sentry.io/1285464')
  .addPlugin(RavenVue, Vue)
  .install()

npm run dev下,Vue会主动捕获所有的错误并将其输出到控制台,Sentry无法捕获到错误
查看Sentry详情


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

相关文章

centos6.4下安装配置JDK+TOMCAT+MYSQL教程

2019独角兽企业重金招聘Python工程师标准>>> 一、系统环境和软件包 [rootlocalhost /]# uname -r 2.6.32-358.el6.x86_64 [rootlocalhost /]# cat /etc/centos-release CentOS release 6.4 (Final) 软件包 jdk-6u43-linux-x64-rpm.bin apache-tomcat-6.0.36.tar.gz …

QQ截图右键

1.CtrlAlt 2.右键 3.按下A键转载于:https://www.cnblogs.com/Bruce3555/p/5476622.html

二维树状数组的区间加减及查询 tyvj 1716 上帝造题的七分钟

详细解释见小结。http://blog.csdn.net/zmx354/article/details/31740985 #include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <queue> #include <cmath> #include <s…

git常用命令与概念汇总

设置记住用户名和密码 # --global如果不加则只针对当前项目 # 设置之后需要重新pull一下代码&#xff0c;然后提示输入用户名密码后会自动保存&#xff0c;从而实现记住用户名和密码的目的。 # 这样设置的用户名和密码是以明文的方式存储的。比如你安装了一个Npm包&#xff0c…

CentOS6 Shell脚本/bin/bash^M: bad interpreter错误解决方法

为什么80%的码农都做不了架构师&#xff1f;>>> 在windows下保存了一个脚本文件&#xff0c;用ssh上传到centos&#xff0c;添加权限执行nginx提示没有那个文件或目录。shell脚本放到/etc/init.d/目录下&#xff0c;再执行/etc/init.d/nginx&#xff0c;提示多了这…

[并查集] hihocoder 1158 质数相关

题目大意 题目链接&#xff0c;定义两个数\(a,b\)质数相关满足 \(ba\times p\), 且\(p\)是质数。给定数组&#xff0c;问最大质数无关子集大小。 算法思路 首先想到的是将每个数看作一个顶点&#xff0c;质数相关的两个数之间连边&#xff0c;求最大独立子集。但是最大独立子集…

Spring Cloud 微服务的那点事

在详细的了解SpringCloud中所使用的各个组件之前&#xff0c;我们先了解下微服务框架的前世今生。 单体架构 在网站开发的前期&#xff0c;项目面临的流量相对较少&#xff0c;单一应用可以实现我们所需要的功能&#xff0c;从而减少开发、部署和维护的难度。这种用于简单的增删…

Swift - 类扩展(extension)

&#xff08;本文代码已升级至swift3&#xff09;Swift语言的类扩展是一个强大的工具&#xff0c;我们可以通过类扩展完成如下事情&#xff1a; 1&#xff0c;给已有的类添加计算属性和计算静态属性2&#xff0c;定义新的实例方法和类方法3&#xff0c;提供新的构造器4&#xf…