Socket
Book a DemoInstallSign in
Socket

mensch

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mensch

A decent CSS parser

latest
Source
npmnpm
Version
0.3.4
Version published
Weekly downloads
1.2M
0.75%
Maintainers
2
Weekly downloads
 
Created

What is mensch?

The mensch npm package is a CSS parser and stringifier. It allows you to parse CSS into an abstract syntax tree (AST) and then stringify it back into CSS. This can be useful for manipulating CSS programmatically.

What are mensch's main functionalities?

Parsing CSS

This feature allows you to parse a CSS string into an abstract syntax tree (AST). The AST can then be manipulated programmatically.

const mensch = require('mensch');
const css = 'body { color: red; }';
const ast = mensch.parse(css);
console.log(ast);

Stringifying CSS

This feature allows you to convert an abstract syntax tree (AST) back into a CSS string. This is useful after you have made programmatic changes to the AST.

const mensch = require('mensch');
const ast = {
  type: 'stylesheet',
  stylesheet: {
    rules: [
      {
        type: 'rule',
        selectors: ['body'],
        declarations: [
          {
            type: 'declaration',
            property: 'color',
            value: 'red'
          }
        ]
      }
    ]
  }
};
const css = mensch.stringify(ast);
console.log(css);

Other packages similar to mensch

Keywords

css

FAQs

Package last updated on 09 Nov 2019

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