Skip to content

Better support for error reporting #98

@nex3

Description

@nex3

Feature Use Case

One of the really nice features of the PostCSS API is its Node.error() method, which returns a CssSyntaxError with all the information necessary to identify the location of errors in the source stylesheet. It would be really nice to be able to do the same thing for value nodes.

Feature Proposal

Although postcss-values-parser inherits the error(), but it's currently not very useful—it always returns an error with line 1, column 1, and no filename.

I propose that the parse() function take a node option which is a PostCSS node that indicates the context of the value being parsed. The node's filename, line, and column numbers can then be used to locate the value nodes within the parent stylesheet, which information can in turn be fed into the error() method to produce useful errors.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions