GithubHelp home page GithubHelp logo

rem2px-loader's Introduction

rem2px-loader

webpack rem2px rem2rem loader

Installation

Run npm install rem2px-loader --save-dev

Usage

import rem2px from 'rem2px-loader';

module: {
  rules: [{
    test: /\.css$/,
    use: [
      {
        loader: 'style-loader'
      },
      {
        loader: 'css-loader'
      },
      {
        loader: 'rem2px-loader',
        options: {
          transformType: 'px',   // rem transform dest type : 'px' | 'rem' (default: 'px')
          sdw: 1920,        // src css design width (default: 1920)
          ddw: 1920,       // dest css design width (default: 1920)
          srfs: 100,  // src root fontsize value (default: 100)
          drfs: 100, // dest root fontsize value (default: 100)
          forbidComment: 'no',   // no transform value comment (default: `no`)
          precision: 4,          // transformed px or rem precision
          remLimit: 0            // no transform rem limit(default: 0)
        }
      }
    ]
  }]
}

rem2px: srcRemValue * srfs * (ddw / sdw)

rem2rem: srcRemValue * srfs * (sdw / ddw) / drfs

License

MIT © 2022 Duzhijie Inc.

rem2px-loader's People

Contributors

duzhijie317 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.