Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mollahdev/cssom-lite

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mollahdev/cssom-lite

Generate css with javascript

  • 1.0.8
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Installation

CSSOM-Lite

CSSOM-Lite is available as an npm package.

npm:

npm i @mollahdev/cssom-lite

Import and register device:

import CSSOMLite from '@mollahdev/cssom-lite';

const sheet = new CSSOMLite();

// register devices
sheet.addDevice('mobile', 575);
sheet.addDevice('tablet', 768);
sheet.addDevice('laptop', 911);

Add custom plain css text

sheet.addCSS(`
    @import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
    * {
        margin: 0;
        padding: 0;
    }
`)

Add rule

CSSOM-lite ignores these properties/values, undefined, null, false, true, NaN, ''

sheet.addRule('.selector-a', 'background: orange');
sheet.addRule('.selector-a', 'color: white; text-decoration:none');

Add rule and remove old value

By using "remove" property like the example, you can remove already added value, note: remove property will be ignored in the final css ouput

sheet.addRule('.selector-a', 'background: orange');
sheet.addRule('.selector-a', `
    color: white; text-decoration:none;
    remove: background, border, fill;
`);

Add responsive rule

sheet.addRule('.selector-a', 'text-decoration: underline', {max: 'mobile'});
sheet.addRule('.selector-heading', 'font-size: 24px', {min: 'mobile', max: 'tablet'});

Clear everything

sheet.clear();

Get output

sheet.output()

Keywords

FAQs

Package last updated on 16 Dec 2023

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc