sass Variables Interpolation


Variables can be used in string interpolation. This allows you to dynamically generate selectors, properties and values. And the syntax for doing so a variable is #{$variable}.

$className: widget;
$content: 'a widget';
$prop: content;

.#{$className}-class {
  #{content}: 'This is #{$content}';
// Compiles to

.widget-class {
  content: "This is a widget";

You cannot, however use it to dynamically generate names of mixins or functions.