# @x-drive/flexible

> 用于配合 postcss-pxtorem 等模块实现自适应布局的页端模块

Latest version **1.0.1** (published 2022-09-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @x-drive/flexible
pnpm add @x-drive/flexible
yarn add @x-drive/flexible
bun add @x-drive/flexible
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-09-13 |
| First published | 2021-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 36.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | digiaries |
| Maintainers | edwinchen |

## Links

- npm: https://www.npmjs.com/package/@x-drive/flexible
- Repository: https://github.com/x-dirve/flexible
- Homepage: https://github.com/x-dirve/flexible#readme
- Issues: https://github.com/x-dirve/flexible/issues
- npm.io page: https://npm.io/package/@x-drive/flexible

## Recent versions

- 1.0.1 (latest) — 2022-09-13
- 1.0.0 — 2021-02-22

## README

# 页端设置基本字体大小模块

用于配合 `postcss-pxtorem` 等模块实现自适应布局的页端模块。

## 使用

- 在项目已启用如 `postcss-pxtorem` 等模块的情况下，在项目入口文件中调用模块并执行
    ```javascript
    import flexible from "@x-drive/flexible";
    flexible();
    ```
- 如果在存在同个域名下有不同项目的情况，为了防止不同项目之间互相干扰，可以在初始化的时候传入特征字符串做为区分
    ```javascript
    import flexible from "@x-drive/flexible";
    flexible("PROJECT_ONE"); // localStorage 中的储存 key 为： FLEXIBLE_UFJPSkVDVF9PTkU=_WINDOW_WIDTH
    ```
    模块默认会尝试将传入的字符串 base64 编码，如不希望被编码可将第二个参数设置为 `true`
    ```javascript
    import flexible from "@x-drive/flexible";
    flexible("PROJECT_ONE", true); // localStorage 中的储存 key 为：FLEXIBLE_PROJECT_ONE_WINDOW_WIDTH
    ```
- 设置默认字体大小
    `flexible` 提供了第三个参数用于设置默认的字体大小（默认为 12）
    ```js
    // 第二个参数按照实际需求设置即可
    flexible("PROJECT_ONE", true, 14);
    ```

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