Socket
Socket
Sign inDemoInstall

style-mod

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

style-mod

A minimal CSS module shim


Version published
Maintainers
1
Created

What is style-mod?

The style-mod npm package is a library for defining and managing CSS styles in JavaScript. It allows you to create, update, and manage styles dynamically, making it easier to handle CSS in a modular and programmatic way.

What are style-mod's main functionalities?

Creating Styles

This feature allows you to create a new style object with specified CSS properties. The example demonstrates creating a style with red text, blue background, and 10px padding.

const { Style } = require('style-mod');

const myStyle = new Style({
  color: 'red',
  backgroundColor: 'blue',
  padding: '10px'
});

console.log(myStyle);

Updating Styles

This feature allows you to update an existing style object with new CSS properties. The example shows updating the color to green and adding a 5px margin.

myStyle.update({
  color: 'green',
  margin: '5px'
});

console.log(myStyle);

Applying Styles to Elements

This feature allows you to apply the defined styles to a DOM element. The example demonstrates creating a div element, applying the style to it, and appending it to the document body.

const element = document.createElement('div');
myStyle.apply(element);
document.body.appendChild(element);

Other packages similar to style-mod

Keywords

FAQs

Package last updated on 01 Mar 2021

Did you know?

Socket

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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc