Skip to content

singleparty/babel-plugin-idle-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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}}或者后补充成为一个表达式

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published