Skip to content

Comment stripping applied in strings #177

Open

Description

@sarken

It looks like comment stripping might be a little overly aggressive. I'd expect it to ignore /* and */ in strings and simply return the original string, but instead it does the following:

Example 1

Input

.test-1 {
  content: "/* this is just a string */";
}

Output

.test-1 {
  content: "";
}

Example 2

Input

.test-2[name="/*"] {
  background: yellow;
}

.test-3[name="*/"] {
  display: flex;
}

Output

.test-2[name=""] {
  display: flex;
}

Activity

  1. grosser commented on Oct 18, 2025

    @grosser
    Contributor

    yeah looks like a bug ... might be hard to fix since a lot of things are done via regex
    PR welcome if you have an idea how to fix ... but might need a full css syntax parser which would be a complete overhaul
    maybe possible by finding some c-based library to wrap, but that might already exist as another gem

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions