Registry / testing / gonzales-pe-sl

gonzales-pe-sl

JSON →
library4.2.3jsnpmunverified

A temporary fork of gonzales-pe, version 4.2.3, created specifically for sass-lint. It is a CSS parser that supports SCSS, Sass, and LESS syntaxes, producing a parse tree that can be traversed, modified, and serialized back to CSS. The package is unmaintained and intended only as a transitional dependency for sass-lint; newer projects should use postcss-scss or postcss-less instead. The release cadence is effectively frozen.

npm install gonzales-pe-sl
INSTALL
IMPORT
SIG · GONZALES-PE-SL
G
gonzales-pe-sl
testingjavascriptv4.2.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gonzales
const gonzales = require('gonzales-pe-sl');
import gonzales from 'gonzales-pe-sl';
Package does not support ESM; use CommonJS require. The symbol is the default export, typically named gonzales.
parse
const parseTree = gonzales.parse(css, {syntax: 'scss'});
gonzales is the default require, and parse is a method on it. The syntax option is required for non-CSS syntaxes.
createNode
const node = gonzales.createNode({ type: 'selector', content: 'div' });
import { createNode } from 'gonzales-pe-sl';
createNode is a method on the default export, not a named export.
Types (Node types)
// Node types are strings like 'selector', 'declaration', 'value', etc. Refer to docs.
import { NodeType } from 'gonzales-pe-sl';
No TypeScript types or enums are provided; node types are plain strings.

Shows how to require the package, parse SCSS with options, traverse the tree recursively finding selectors, and convert back to string.

const gonzales = require('gonzales-pe-sl'); // Parse SCSS const css = ` .container { $color: red; .item { color: $color; } }`; const options = { syntax: 'scss', tabSize: 2 }; const parseTree = gonzales.parse(css, options); console.log(parseTree.type); // 'stylesheet' // Traverse and find selectors const findSelectors = (node) => { if (node.type === 'selector') { console.log('Found selector:', node.content.map(t => t.content).join('')); } if (node.content && Array.isArray(node.content)) { node.content.forEach(findSelectors); } }; findSelectors(parseTree); // Convert back to string const stringified = parseTree.toString(); console.log(stringified);
Debug
Known issues
deprecatedgonzales-pe-sl is a temporary fork for sass-lint only; not intended for direct use. Use postcss-scss or postcss-less instead.
fix
Replace with postcss-scss (npm install postcss-scss) or postcss-less, and use postcss's AST API.
affects: >=0.0.0
breakingNo ES module (ESM) support; only CommonJS require() works. Attempting to import will fail.
fix
Use require() as shown in the quickstart, or consider switching to a modern parser.
affects: >=4.0.0
gotchaThe parse tree node types are plain strings; no TypeScript types or documentation beyond node-types.md. Nodes may have unexpected structures.
fix
Refer to the original gonzales-pe docs for node types; for TypeScript projects, consider using @types/gonzales-pe (if available) or switch to postcss.
affects: >=4.0.0
breakingThe package is no longer maintained and will not receive security updates or bug fixes.
fix
Migrate to a maintained alternative like postcss-scss or gonzales-pe-dev (not recommended).
affects: >=4.2.3
Errors
Common errors & fixes
Cannot find module 'gonzales-pe-sl'
Package not installed
fix
npm install gonzales-pe-sl
gonzales.parse is not a function
Using ES import instead of require
fix
Change import gonzales from 'gonzales-pe-sl' to const gonzales = require('gonzales-pe-sl');
TypeError: Cannot read property 'type' of undefined
Parsing failed, likely due to missing syntax option or invalid CSS
fix
Ensure you pass the correct syntax option (e.g., {syntax: 'scss'}) and valid CSS string.
Unrecognised input
Parser cannot handle the input syntax because it is not supported (e.g., some newer CSS features).
fix
Simplify the input or switch to a more modern parser like postcss-scss.
Upgrade
Version history
4.2.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
gonzales-pe-sl — npm install gonzales-pe-sl · libregistry