
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
postcss-px-to-upx
Advanced tools
A CSS post-processor that converts px to uni-app units (rpx, upx).
English | 中文
A plugin for PostCSS that generates uniapp units (rpx, upx) from pixel units.
.class {
margin: -10DP .5DP;
padding: 5DP 9.5DP 1px;
border: 3DP solid black;
border-bottom-width: 1px;
font-size: 14DP;
line-height: 20DP;
}
.class {
margin: -3.125rpx .5rpx;
padding: 5rpx 2.96875rpx 1px;
border: 0.9375rpx solid black;
border-bottom-width: 1px;
font-size: 4.375rpx;
line-height: 6.25rpx;
}
Add via npm
$ npm install postcss-px-to-upx --save-dev
or yarn
$ yarn add -D postcss-px-to-upx
Default Options:
{
unitToConvert: 'DP',
viewportWidth: 414,
viewportHeight: 750,
unitPrecision: 5,
propList: ['*'],
viewportUnit: 'rpx',
fontViewportUnit: 'rpx',
selectorBlackList: [],
exclude: undefined,
include: undefined
}
unitToConvert
(String) unit to convert, by default, it is DP.viewportWidth
(Number) The width of the viewport.unitPrecision
(Number) The decimal numbers to allow the vw units to grow to.propList
(Array) The properties that can change from px to vw.
viewportUnit
(String) Expected units.fontViewportUnit
(String) Expected units for font.selectorBlackList
(Array) The selectors to ignore and leave as px.
['body']
will match .body-class
[/^body$/]
will match body
but not .body
exclude
(Regexp or Array of Regexp) Ignore some files like 'node_modules'
include
(Regexp or Array of Regexp) If include
is set, only matching files will be converted,
for example, only files under src/mobile/
(include: /\/src\/mobile\//
)
exclude
andinclude
can be set together, and the intersection of the two rules will be taken.
add to your postcss.config.js
module.exports = {
plugins: {
// ...
'postcss-px-to-upx': {
// options
}
}
}
add to your gulpfile.js
:
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var pxtoviewport = require('postcss-px-to-upx');
gulp.task('css', function () {
var processors = [
pxtoviewport({
viewportWidth: 414,
viewportUnit: 'rpx'
})
];
return gulp.src(['build/css/**/*.css'])
.pipe(postcss(processors))
.pipe(gulp.dest('build/css'));
});
FAQs
A CSS post-processor that converts px to uni-app units (rpx, upx).
The npm package postcss-px-to-upx receives a total of 0 weekly downloads. As such, postcss-px-to-upx popularity was classified as not popular.
We found that postcss-px-to-upx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.