
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@lezer/css
Advanced tools
@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.
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());
PostCSS is a tool for transforming CSS with JavaScript plugins. It provides a way to parse CSS into an Abstract Syntax Tree (AST), which can then be manipulated and transformed. Compared to @lezer/css, PostCSS is more focused on transforming and processing CSS rather than just parsing it.
CSSTree is a tool for working with CSS, including parsing, generating, and analyzing CSS code. It provides a detailed AST and various utilities for manipulating CSS. CSSTree offers more comprehensive features for CSS analysis and transformation compared to @lezer/css.
Stylelint is a modern linter that helps you avoid errors and enforce conventions in your styles. While it also parses CSS, its primary focus is on linting and enforcing coding standards, which is different from the primary parsing focus of @lezer/css.
This is a CSS grammar for the lezer parser system.
The code is licensed under an MIT license.
1.0.1 (2022-10-10)
Add support for the is
, where
, host-context
, nth-last-of-type
, and nth-of-type
pseudo classes.
Apply a consistent highlighting tag (definitionKeyword
) to all @ keywords.
FAQs
lezer-based CSS grammar
The npm package @lezer/css receives a total of 559,496 weekly downloads. As such, @lezer/css popularity was classified as popular.
We found that @lezer/css demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.