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

@lezer/css

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lezer/css

lezer-based CSS grammar

  • 0.15.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
508K
increased by3.7%
Maintainers
1
Weekly downloads
 
Created

What is @lezer/css?

@lezer/css is a parser for CSS written using the Lezer parser system. It provides a way to parse CSS code into a syntax tree, which can be useful for syntax highlighting, code analysis, and other tooling purposes.

What are @lezer/css's main functionalities?

Parsing CSS

This feature allows you to parse a CSS string into a syntax tree. The code sample demonstrates how to use the parser to convert a CSS string into a tree structure.

const {parser} = require('@lezer/css');
const input = 'body { color: red; }';
const tree = parser.parse(input);
console.log(tree.toString());

Syntax Tree Traversal

This feature allows you to traverse the syntax tree generated by the parser. The code sample shows how to use a TreeCursor to iterate over the nodes in the syntax tree.

const {parser} = require('@lezer/css');
const {TreeCursor} = require('@lezer/common');
const input = 'body { color: red; }';
const tree = parser.parse(input);
let cursor = tree.cursor();
do {
  console.log(cursor.node.type.name);
} while (cursor.next());

Other packages similar to @lezer/css

FAQs

Package last updated on 24 Sep 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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc