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-prettier-plugin

v1.0.0

Published

vue

Downloads

2

Readme

VuePrettierPlugin

VuePrettierPlugin 是一个用于在 Vue2 项目中自动格式化代码的 Webpack 插件。该插件不需要依赖vscode中的prettier插件,添加该插件后即可在运行时根据配置项格式化文件。

安装

使用 npm 进行安装:

npm install vue-prettier-plugin --save-dev

使用

在你的 vue.config.js 文件中引入和使用插件:

const VuePrettierPlugin = require('vue-prettier-plugin');

module.exports = {
  // ...其他配置
  configureWebpack: {
    plugins: [
      new VuePrettierPlugin(
        {
          // Prettier 格式化选项
          printWidth: 100,
          tabWidth: 4,
          // ...其他选项
        },
        'src/',//格式化文件路径,默认 src/
      ),
    ],
  },
};

选项

  • option(Object):Prettier 格式化选项,具体配置参考 Prettier 文档
  • watchOptions(Object):监视选项,用于指定需要监视的目录和文件。
  • watchDirs(Array|string,默认为 'src/'):需要监视的目录路径,可以是字符串或字符串数组。

注意事项

  • 该插件会在编译过程中自动格式化指定目录下的 Vue 文件。
  • 请确保已经安装了 vue-loadervue-template-compiler
  • 为了防止不必要的错误,建议在开发环境中使用该插件。
  • 如果觉得有用,帮忙点个star! github地址:vue-prettier-plugin

VuePrettierPlugin

VuePrettierPlugin is a Webpack plugin designed to automatically format code in Vue2 projects. This plugin does not require the prettier extension found in vscode. Once added, it enables runtime code formatting based on the configuration settings.

Installation

Install using npm:

npm install vue-prettier-plugin --save-dev

Usage

Import and use the plugin in your vue.config.js file:

const VuePrettierPlugin = require('vue-prettier-plugin');

module.exports = {
  // ...other configurations
  configureWebpack: {
    plugins: [
      new VuePrettierPlugin(
        {
          // Prettier formatting options
          printWidth: 100,
          tabWidth: 4,
          // ...other options
        },
        'src/',//Format file path, default src/
      ),
    ],
  },
};

Options

  • option (Object): Prettier formatting options, refer to the Prettier documentation for specific configuration.
  • watchOptions (Object): Watch options for specifying directories and files to monitor.
  • watchDirs (Array|string, default is 'src/'): Directories to be watched, can be a string or an array of strings.

Notes

  • This plugin automatically formats Vue files in the specified directories during the compilation process.
  • Make sure you have vue-loader and vue-template-compiler installed.
  • It's recommended to use this plugin in development environment to avoid unnecessary errors.
  • If you find it helpful, please consider giving it a star! GitHub repository link: vue-prettier-plugin