Search code examples
csssassless

How to use $ character in sass file


I have some sass files that contain the $ character. All files get errors when compiling. Because $ is reserved in sass. In the next example I want to select all css classes ending with 9. How to use $ Any idea .

[class$="9"]:after {
    background-color: #3d9970 !important;
}

Solution

  • Not sure what compiler you are using (dart or node) but you should be able to escape it using #{'$'}:

    [class#{'$'}="9"]:after {
        background-color: #3d9970 !important;
    }