# jsx-spmlog

> add spm attribute to .jsx file

Latest version **0.0.2** (published 2020-02-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install jsx-spmlog
pnpm add jsx-spmlog
yarn add jsx-spmlog
bun add jsx-spmlog
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2020-02-24 |
| First published | 2020-02-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | yexi |
| Maintainers | yexi |

## Links

- npm: https://www.npmjs.com/package/jsx-spmlog
- Repository: git@gitlab.alibaba-inc.com:mm/jsx-spmlog
- npm.io page: https://npm.io/package/jsx-spmlog

## Dependencies (1)

- [gogocode](https://npm.io/package/gogocode.md) ^0.0.9

## Recent versions

- 0.0.2 (latest) — 2020-02-24
- 0.0.1 — 2020-02-24

## README

# jsx-spmlog
## 为目录下所有jsx文件增删spm埋点
`<a onClick="add" data-spm-click="gostr=/dd;locaid=db2ee5204;"></a>`
### 1.引入模块
`const spmlog = require('jsx-spmlog')`

### 2.增加埋点
给标签增加data-spm-click属性，已有埋点的不会重复加

`spmlog({
    gostr: '/dd',  // 必传！
    opr: 'add',  // 非必填，默认是add
    path: '',   // 非必传，默认是'src/**/*.jsx',
    selectors: ''   // 非必传，默认是a标签和含有onClick属性的标签
})`

### 3.移除埋点
把标签上的data-spm-click属性移除

`spmlog({
    opr: 'remove',  // 必填
    path: '',   // 非必传，默认是'src/**/*.jsx',
    selectors: ''   // 非必传，默认是所有含有data-spm-click属性的标签
})`

---
_Source: https://npm.io/package/jsx-spmlog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
