Search code examples
sasscompass-sass

SASS with custom template selector


I am using a templating system where I need to set the CSS selector to #%id%. However, no matter how I try to trick SASS into using that selector I cannot get it to work. Does anyone have any ideas on how I can make this work?

I am always getting this error.

Invalid CSS after "#": expected id name, was "%id%"

Update:

Here is what I have tried...

@mixin thing($id) {
  ##{$id} {
    color:red;
  }
}
@include thing(unquote('%id%'));

...and...

$id:'%id%';
##{unquote($id)} {
  color:red;
}

...lastly...

#%id% {
  color:red;
}

Solution

  • There's no way to do this. #%id% is an invalid CSS selector, and Sass can't parse it.