babel-plugin-idle-code

1.0.7 • Public • Published

babel-plugin-idle-code

自动生成一些有规律的模板代码,看着简洁一些,好像也没啥用


Example

安装

npm install babel-plugin-idle-code

配置 babel.config.jsplugins

module.exports = {
  plugins: [
    'idle-code'
  ]
}

使用

import a, { b, c } from './utils/index'
// @idle-code: ./utils/index as {{name}}(1111)

           

import a, { b, c } from './utils/index'
b(1111)
c(1111)
import { Button, Cell } from 'vant'
// @idle-code: vant as Vue.use({{name}})

           

import { Button, Cell } from 'vant'
Vue.use(Button)
Vue.use(Cell)

使用规则

  • 只支持顶层作用域 单行注释 单个特性导出 的模块

  • {{name}}是匹配符,name就是导出的模块名称

  • 语法为

// @idle-code: 模块名 as 可以前{{name}}或者后补充成为一个表达式

Package Sidebar

Install

npm i babel-plugin-idle-code

Weekly Downloads

1

Version

1.0.7

License

MIT

Unpacked Size

4.29 kB

Total Files

3

Last publish

Collaborators

  • singleparty