Wondering what’s next for npm?Check out our public roadmap! »

    postcss-rpx-plugin
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.3 • Public • Published

    postcss-rpx-plugin

    rpx2vw

    中文 README

    Usage

    npm i postcss-rpx-plugin -D
    

    package.json

    {
      "dependencies": {},
      "devDependencies": {},
      "postcss": {
        "plugins": {
          "postcss-rpx-plugin": {
            "unit": "rpx",
            "width": 750,
            "precision": 5,
            "outUnit": "vw",
            "exclude": ""
          }
        }
      }
    }

    CHANGELOG

    V1.0.0

    • Int rpx
      it("should replace the rpx unit with vw - Int", () => {
        const rules = ".rule { margin: 10rpx 375rpx 0rpx 10px; }";
        const expected = ".rule { margin: 1.33333vw 50vw 0 10px; }";
        const processed = postcss(rpx2vm()).process(rules).css;
        expect(processed).toBe(expected);
      });

    V1.0.1

    • Float rpx

      it("should replace the rpx unit with vw - Float", () => {
        const rules = ".rule { height: 375.0rpx; }";
        const expected = ".rule { height: 50vw; }";
        const processed = postcss(rpx2vm()).process(rules).css;
        expect(processed).toBe(expected);
      });
    • url ignore

      it("should not replace values in `url()`", () => {
        const rules = ".rule { background: url(16rpx.jpg); }";
        const expected = ".rule { background: url(16rpx.jpg); }";
        const processed = postcss(rpx2vm()).process(rules).css;
        expect(processed).toBe(expected);
      });

    V1.0.2

    • add @type

      import { AcceptedPlugin } from "postcss";
      
      declare function PostcssRpxPlugin(
        options: PostcssRpxPlugin.Options | Partial<PostcssRpxPlugin.Options>
      ): AcceptedPlugin;
      
      declare namespace PostcssRpxPlugin {
        interface Options {
          unit: string;
          width: number;
          precision: number;
          outUnit: string;  
          exclude: string | RegExp;
        }
      }
      
      export = PostcssRpxPlugin;

      V1.0.3

    • fix build options?.unit error

    • fix type ?

    Thanks

    postcss-rpxtopx

    postcss-rpx-loader

    Install

    npm i postcss-rpx-plugin

    DownloadsWeekly Downloads

    7

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    10 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar