0.5.5 • Published 7 years ago
postcss-flexible v0.5.5
postcss-flexible
This is a postcss plugin for translating dpr(...), rem(...), url(...). Similar to px2rem, but using custom function istead of comments for syntax.
Usage
Webpack
module.exports = {
module: {
loaders: [
{
test: /\.css$/,
loader: "style-loader!css-loader!postcss-loader"
}
]
},
postcss: function() {
// remUnit defaults to 75
return [require('postcss-flexible')({remUnit: 75})]
}
}Example
Before processing:
.selector {
font-size: dpr(32px);
width: rem(75px);
line-height: 3;
/* replace all @[1-3]x in urls: `/a/@2x/x.png`, `/a@2x/x.png` or `/a/x@2x.png` */
background-image: url(/images/qr@2x.png);
}After processing:
.selector {
width: 1rem;
line-height: 3;
}
[data-dpr="1"] .selector {
font-size: 16px;
background-image: url(/images/qr@1x.png);
}
[data-dpr="2"] .selector {
font-size: 32px;
background-image: url(/images/qr@2x.png);
}
[data-dpr="3"] .selector {
font-size: 48px;
background-image: url(/images/qr@3x.png);
}options
desktop: boolean, defaultfalsebaseDpr: number, default2remUnit: number, default75remPrecision: number, default6addPrefixToSelector: functiondprList: array, default[3, 2, 1]fontGear: array, default[-1, 0, 1, 2, 3, 4]enableFontSetting: boolean, defaultfalseaddFontSizeToSelector: functionoutputCSSFile: function
Change Log
0.5.0
- add: generate different css files with fontGear
- support custom
fontGear - support custom
enableFontSetting - support custom
addFontSizeToSelector - support custom
outputCSSFile
0.4.0
- support custom
dprList
0.3.0
- add option
desktopandaddPrefixToSelector
0.1.0
- handle
url()
0.0.3
- add
dpr()andrem()
0.0.0
- First release.
License
MIT
0.5.5
7 years ago
0.5.4
7 years ago
0.5.3
7 years ago
0.5.2
7 years ago
0.5.1
7 years ago
0.5.0
7 years ago
0.4.1
9 years ago
0.4.0
9 years ago
0.3.0
9 years ago
0.2.3
9 years ago
0.2.2
9 years ago
0.2.1
10 years ago
0.2.0
10 years ago
0.1.2
10 years ago
0.1.1
10 years ago
0.1.0
10 years ago
0.0.4
10 years ago
0.0.3
10 years ago
0.0.2
10 years ago
0.0.1
10 years ago
0.0.0
10 years ago