Socket
Socket
Sign inDemoInstall

jss-plugin-default-unit

Package Overview
Dependencies
6
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jss-plugin-default-unit

JSS plugin that adds default custom unit to numeric values where needed


Version published
Weekly downloads
2M
increased by4.92%
Maintainers
1
Install size
2.01 MB
Created
Weekly downloads
 

Package description

What is jss-plugin-default-unit?

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.

What are jss-plugin-default-unit's main functionalities?

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'
}));

Other packages similar to jss-plugin-default-unit

Readme

Source

jss-plugin-default-unit

Version License Downlodas Size Dependencies

JSS plugin that adds default custom unit to numeric values where needed

See our website jss-plugin-default-unit for more information.

Install

Using npm:

npm install jss-plugin-default-unit

or using yarn:

yarn add jss-plugin-default-unit

Keywords

FAQs

Last updated on 09 Feb 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc