Skip to content

Changes string contents in at-rules #3021

Closed

Description

@tzi

Hi everyone!

In SCSS, we can output some text with @debug, @warn and @error directive.
I noticed that prettier try to reformat my text, like adding a space after parenthesis.

Input:

@if ($error) {
  @error 'error (#{$error}).';
}

Output:

@if ($error) {
  @error 'error (#{$error}) .';
}

Here is a Playground link (prettier 1.7.4).

Thanks for a lot this tool!

Cheers,
Thomas.

Activity

  1. lydell commented on Oct 13, 2017

    @lydell
    Member

    Good catch! What's happening here is that the parser does not consider that to be a string at all, so all sorts of weird things could happen.

  2. added
    lang:css/scss/less
    on Oct 13, 2017
  3. changed the title [-]Prevent prettying SCSS output text[/-] [+]Changes string contents in at-rules[/+] on Oct 16, 2017
  4. zeorin commented on Oct 21, 2017

    @zeorin

    I'm also having this issue with node-sass-selector-importer:

    Input:

    @import '{ $shadow, $accent-1, $placeholder } from settings/colour';
    

    Output:

    @import , $accent-1, $placeholder } from settings/colour';
    

    Temporary workaround:

    @import '{ $shadow } from settings/colour';
    @import '{ $accent-1 } from settings/colour';
    @import '{ $placeholder } from settings/colour';
    
  5. added
    status:has pr
    on Jan 19, 2018
  6. added
    locked-due-to-inactivity
    on Jul 6, 2018
  7. locked as resolved and limited conversation to collaborators on Jul 6, 2018
  8. added theissue type on Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:css/scss/lesslocked-due-to-inactivitystatus:has pr

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions