svrx
  • Languages
  • svrx
  • svrx
    • SUMMARY
    • Contributing to svrx
    • Getting Started
    • Blog
      • Server-X: A Pluggable Platform For Local Frontend Development
    • Guide
      • API Reference
      • Option Reference
      • How To Use Routes
    • Plugins
      • How To Write A Plugin
      • How To Use Plugins
    • Practice
      • Integrations
      • Recipes
  • svrx
    • 概要
    • 贡献指南
    • 快速上手
    • Blog
      • Server-X:一款可能提升你十倍工作效率的工具
      • 使用 svrx 实现更优雅的接口 Mock
      • 说说 Server-X 的免安装插件机制
    • 进阶指南
      • API 索引
      • 参数列表
      • Routing 路由的使用
    • 插件体系
      • 如何写一个插件
      • 插件的使用
    • 项目实战
      • 结合主流脚手架使用
      • 特定场景使用
Powered by GitBook
On this page
  • Command Line
  • .svrxrc.js config file
  • scope

Was this helpful?

  1. svrx
  2. Plugins

How To Use Plugins

Command Line

You can use plugins through command line options, eg:

svrx --plugin markdown -p qrcode # -p is alias of --plugin
svrx --markdown --qrcode         # set a pluginName to true to start a plugin quickly
svrx --plugin "qrcode?ui=false"  # use 'name?querystring' to add params to a plugin
svrx --plugin "webpack@0.0.3"    # use 'name@version' to specify the version of plugin

.svrxrc.js config file

And also, you can enable and config a plugin through plugins in .svrxrc.js file, eg:

// .svrxrc.js
module.exports = {
  plugins: [
    'markdown',
    {
      name: 'qrcode',
      options: {
        ui: false,
      },
    },
    {
      name: 'webpack',
      version: '0.0.3',
    },
  ],
};

Then run svrx in the root place of your project, we'll install plugin markdown, qrcode, webpack, and start them automatically.

scope

You can specific a scoped plugin with @<scope>/<name>.

For example, if the package name of a plugin is svrx-plugin-foo, and the scope name is bar, then you can use it like so:

svrx --@bar/foo 
svrx -p @bar/foo
svrx -p "@bar/foo@0.0.3"

Or:

// .svrxrc.js
module.exports = {
  plugins: [
    '@bar/foo',
    {
      name: '@bar/foo',
      options: {
        bar: false,
      },
    },
  ],
};
PreviousHow To Write A PluginNextPractice

Last updated 3 years ago

Was this helpful?

Svrx plugin also support .

You can easily create a scoped plugin through our official tool .

npm-scope
svrx-create-plugin