Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rpx-rem

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rpx-rem

a tool to convert rpx to rem

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rpx-rem

a tool to convert rpx to rem

##How to convert static files

npm install rpx-rem -g

rpx2rem

you can set a config

rpx2rem --config rpxrem.config.js

##config

default config:

    {
	    patterns: "**/*.css",
        rpxToRemRatio: 0.01,
        ignoreCss: [],
        isReplace: false,
        convertBorder1rpx: false
    }

you can create a new file in the current directory, for example: rpxrem.config.js

    module.exports = {
	    patterns: "./WrcIosselect/lib/WrcIosselect.css",
        rpxToRemRatio: 0.01,
        ignoreCss: ['font-size', 'line-height'],
        isReplace: false,
        convertBorder1px: true
    };

then you can run like this:

rpx2rem --config rpxrem.config.js

##parammeter

   patterns: visite https://www.npmjs.com/package/glob to see pattern

   rpxToRemRatio: the ratio of rpx and rem

ignoreCss: will not convert the CSS property

isReplace: whether or not to replace the original file

   convertBorder1rpx: whether or not to convert 1 pixel wide border


##How to use as a webpack loader

package.json:

    "devDependencies": {
        "rpx-rem": "*"
    }
in webpack.config.js:
    module.exports = {
        node: {
            fs: "empty"
        },
        module: {
            loaders: [
                {
                    test: /\.css$/,
                    loader: 'style-loader!css-loader!rpx-rem!postcss-loader!less-loader'
                }
            ]
        }
    }

If you use less-loader, sass-loader, postcss-loader and other processing tools, you need to put rpx-rem on their left

you must create a file called rpxrem.webpack.conf.json in the project root directory (same directory with package.json) like this:

    {
        "rpxToRemRatio": 0.01,
        "ignoreCss": [],
        "convertBorder1rpx": true
    }

then you can convert rpx to rem in your project

Keywords

FAQs

Package last updated on 14 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc