unit-convert-loader
v1.0.2
Published
Webpack loader for converting CSS unit
Downloads
6
Readme
unit-convert-loader
Webpack loader for converting CSS unit
Install
npm install unit-convert-loader
Usage
Within your webpack configuration object, you'll need to add the unit-covert-loader to the list of modules, like so:
module: {
rules: [
{
test: /\.vue$/,
exclude: /node_modules/,
use: {
loader: 'unit-covert-loader',
options: {
UIWidth: 640,
targetUnit: 'rem'
}
}
}
]
}
Options
- UIWidth: optional, default
750
. The Design Width. - targetUnit: optional, default
vw
. The unit you want to convert to, it can bevw
orrem
. - minPixelValue: optional, default
1
. The minimum value you set, all value less than it won't be converted. - unitPercesion: optional, default
3
. Number of decimal places retained after conversion. - rem: optional, default
null
. The font size of html node, necessary when targetUnit isrem
.