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

@types/css-tree

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/css-tree

TypeScript definitions for css-tree

  • 2.3.7
  • ts4.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
133K
increased by6.77%
Maintainers
1
Weekly downloads
 
Created

What is @types/css-tree?

@types/css-tree provides TypeScript type definitions for the css-tree library, which is a toolset for working with CSS, including parsing, generating, and transforming CSS code.

What are @types/css-tree's main functionalities?

Parsing CSS

This feature allows you to parse CSS code into an Abstract Syntax Tree (AST). The code sample demonstrates how to parse a simple CSS rule.

const csstree = require('css-tree');
const ast = csstree.parse('.example { color: red; }');
console.log(ast);

Generating CSS

This feature allows you to generate CSS code from an AST. The code sample shows how to generate CSS from a previously parsed AST.

const csstree = require('css-tree');
const ast = csstree.parse('.example { color: red; }');
const css = csstree.generate(ast);
console.log(css);

Transforming CSS

This feature allows you to transform CSS code by walking through the AST and modifying nodes. The code sample demonstrates changing the color property from red to blue.

const csstree = require('css-tree');
const ast = csstree.parse('.example { color: red; }');
csstree.walk(ast, function(node) {
  if (node.type === 'Declaration' && node.property === 'color') {
    node.value = csstree.parse('blue', { context: 'value' });
  }
});
const css = csstree.generate(ast);
console.log(css);

Other packages similar to @types/css-tree

FAQs

Package last updated on 05 Mar 2024

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