A CSS parser with built-in support for SCSS, Sass, and LESS preprocessors, enabling programmatic CSS manipulation.
Gonzales PE is a CSS parser that supports CSS and popular preprocessors like SCSS, Sass, and LESS. It converts CSS code into a structured abstract syntax tree (AST) that developers can programmatically analyze, modify, and serialize back to CSS. It solves the problem of needing a reliable parser for CSS variants when building linters, optimizers, or other CSS processing tools.
Tooling developers, library authors, and engineers building CSS processors, linters, formatters, or static analysis tools that need to handle CSS preprocessor syntax.
Developers choose Gonzales PE for its dedicated support for preprocessor syntaxes, comprehensive tree manipulation API, and ease of integration into Node.js-based tooling chains, avoiding the need to write custom parsers.
CSS parser with support of preprocessors
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Parses CSS, SCSS, Sass, and LESS with configurable syntax options, as shown in the parse method's syntax parameter, making it versatile for preprocessor-heavy projects.
Provides comprehensive methods like traverseByType and eachFor for programmatic AST manipulation, enabling precise node traversal and modification as documented in the README.
Nodes include start and end line/column positions, facilitating accurate source mapping for tools like linters or editors, evidenced by the start and end properties in the API.
Supports parsing CSS strings to trees and serializing modified trees back to strings via the toString method, allowing full round-trip transformations.
Installation requires pointing to the dev git branch, indicating potential instability and lack of formal releases, as per the install instructions using git://github.com/tonyganch/gonzales-pe.git#dev.
The extensive set of methods and node types, documented separately in docs/node-types.md, creates a steep learning curve for newcomers to AST manipulation.
Compared to alternatives like PostCSS, it has fewer third-party plugins and community tools, which may require more custom code for extended functionality.