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

vue-cli-plugin-project-initial

v1.0.2

Published

init project with svg-icon、ant-design-vue、vue-event-bus

Downloads

231

Readme

vue-cli-plugin-project-initial

在项目中添加或引入使用程度非常大的配置或包,最大程度上在vue项目初始结构上进行配置初始化,提高项目开发效率,为前端团队进行开发上的小规范。 此包会对项目目录结构进行修改 此包引入了‘优雅地使用svg的icon’配置、eventBus配置。 此包中依赖了以下npm包:

  1. axios
  2. UI框架ant-design-vue
  3. svg-sprite-loader

使用

vue add project-initial

svg-icon(优雅地使用svg的icon)

webpack配置

// vue.config.js
const path = require('path')

function resolve(dir) {
  return path.join(__dirname, './', dir)
}
module.exports = {
  chainWebpack: config => {
    const svgRule = config.module.rule('svg') // 找到svg-loader
    svgRule.uses.clear() // 清除已有的loader, 如果不这样做会添加在此loader之后
    svgRule.exclude.add(/node_modules/) // 正则匹配排除node_modules目录
    svgRule // 添加svg新的loader处理
      .test(/\.svg$/)
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]',
      })

    // 修改images loader 添加svg处理
    const imagesRule = config.module.rule('images')
    imagesRule.exclude.add(resolve(/src\/plugins\/icon\/svg/)) // icon文件所在目录
    config.module
      .rule('images')
      .test(/\.(png|jpe?g|gif|svg)(\?.*)?$/)
  }
}

使用

  1. src/plugins/icon/svg中新增svg文件,命名为delete.svg
  2. 在vue文件中使用delete.svg
<template>
  <svg-icon icon="delete" class-name="delete-icon">
</template>
<style>
.delete-icon {
  width: 100px;
  height: 100px;
  fill: red;
}
</style>

axios

配置

可在src/plugins/axios/下增加如拦截器等配置

使用

this.$axios

ant-design-vue

配置

可在src/plugins/antd/下增加如自定义引入等配置

使用

<a-button type="primary">
  Primary
</a-button>

详情:ant-design-vue官网

event-bus

配置

可在src/plugins/bus/下增加自定义配置信息

使用

this.$bus.$emit() this.$bus.$on()