Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
jss-plugin-default-unit
Advanced tools
JSS plugin that adds default custom unit to numeric values where needed
The jss-plugin-default-unit npm package is a plugin for JSS (JavaScript Style Sheets) that automatically adds units to numeric values in style objects. This is particularly useful when working with CSS in JS, as it simplifies the process of defining styles by allowing developers to omit units for properties that require them, with the plugin automatically appending the appropriate unit based on the property.
Automatic unit appending
Automatically appends 'px' to numeric values for properties that typically require a pixel unit, while leaving unitless values as is for properties that do not require units.
{
container: {
width: 100, // becomes '100px' automatically
opacity: 0.5 // remains unitless as expected
}
}
Customizable unit mapping
Allows customization of the units appended to specific properties, enabling developers to specify alternative units like 'em' or 'rem' for properties like 'line-height' and 'font-size'.
jss.use(defaultUnit({
'line-height': 'em',
'font-size': 'rem'
}));
Styled-components is a library for styling React components using tagged template literals. It supports automatic unit appending in a similar way to jss-plugin-default-unit but is more focused on component-level styling with a CSS-in-JS approach.
Glamor is a CSS-in-JS library that allows for styling components with JavaScript. It offers similar functionality to jss-plugin-default-unit in terms of automatically appending units to styles defined in JavaScript, but it provides a different API and approach to styling.
JSS plugin that adds default custom unit to numeric values where needed
See our website jss-plugin-default-unit for more information.
Using npm:
npm install jss-plugin-default-unit
or using yarn:
yarn add jss-plugin-default-unit
FAQs
JSS plugin that adds default custom unit to numeric values where needed
The npm package jss-plugin-default-unit receives a total of 1,769,002 weekly downloads. As such, jss-plugin-default-unit popularity was classified as popular.
We found that jss-plugin-default-unit 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
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.