Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Exception.toCssString() in the JS API #3756

Open
zaydek opened this issue Dec 5, 2023 · 1 comment
Open

Expose Exception.toCssString() in the JS API #3756

zaydek opened this issue Dec 5, 2023 · 1 comment
Labels
enhancement New feature or request JS API About the shared JS API

Comments

@zaydek
Copy link

zaydek commented Dec 5, 2023

Hi. Usually I build Sass using the CLI in watch mode, which has the nice characteristic that it compiles Sass, even when it's broken, and uses toCssString (internal Dart method) to serialize the Sass Exception as CSS using ::before so it's viewable in the browser.

I am triyng to compile Sass using the JavaScript API and I'm not seeing any way to get the error/exception formatted in this way, either through the Sass compile options or the SassException. I don't see anything here https://sass-lang.com/documentation/js-api/classes/exception/.

Is there a way developers whom use the JavaScript API can still compile Sass -- with errors -- and get the CSS string generated by this function? https://github.com/sass/dart-sass/blob/cd3b0cc1626f31a909d21fc87112d614cbb013e2/lib/src/exception.dart#L101

Screenshot 2023-12-05 at 8 05 46 AM
@nex3
Copy link
Contributor

nex3 commented Dec 5, 2023

I think it's reasonable to expose a sass.Exception.toCssString() in the JS API. Since this is an API design feature, it should go in the Sass language repository.

@nex3 nex3 changed the title How to get the serialized CSS ::before error when using the JS API? Expose Exception.toCssString() in the JS API Dec 5, 2023
@nex3 nex3 transferred this issue from sass/dart-sass Dec 5, 2023
@nex3 nex3 added enhancement New feature or request JS API About the shared JS API labels Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request JS API About the shared JS API
Projects
None yet
Development

No branches or pull requests

2 participants