@zlicom/autoprefixer
Installation
$ npm install @zlicom/autoprefixer --save-dev
Why @zlicom/autoprefixer ?
- 轻量级前缀添加工具集
- 支持自定义前缀
- 原生 API 代理
Customize
// src/prefixer.ts
const PREFIX_STR = '/you_prefixer'
$ pnpm build
$ npm login
$ pnpm publish
API
prefixerStr(inputStr: string)
返回一个带有前缀的字符串
prefixerStr(); // /your-prefix
prefixerStr('/api'); // /your-prefix/api
$fetch(nput: RequestInfo | URL, init?: RequestInit | undefined)
使用同 window.fetch
$open( url: string | URL | undefined, target?: string | undefined, features?: string | undefined,)
使用同 window.open
$location
代理 window.location
的 href
属性和 replace
方法
registerWindow
注册 $fetch
,$open
和$location
到 window
// src/index.js
import { registerWindow } from '@web-common/auto-prefixer';
const App = () => {
registerWindow();
return <Element></Element>;
};