Gerillass
v2.1.0* You can call mixins with or without the gls- namespace (e.g. @include gls-before();).
The Before Sass mixin helps you generate content or a style element before the actual content of the selected element or elements.
Arguments
| Name | Type | Description |
|---|---|---|
$content | string | You can pass content as a string, or fetch a value using a custom property such as data-content. |
When you want to fetch a value using a custom property, the name of the property must start with the 'data-' prefix. See the examples for more.
Examples
Simply pass a value as a string.
.element{
@include before("Text to use!");
}.element::before {
content: "Text to use!";
}You can target the ::before pseudo-element on its own and pass a declaration block.
.element{
@include before{
content: "Easy to use!";
font-style: italic;
color: red;
};
}.element::before {
content: "Easy to use!";
font-style: italic;
color: red;
}You can fetch a value using a custom property. One important thing to remember is that the name of the property must start with the 'data-' prefix.
<div class="element" data-currency="quot;>200</div>.element{
@include before("data-currency");
}.element::before {
content: attr(data-currency);
}You can pass a value for the CSS content property as a string, and a declaration block between the opening and closing curly braces.
.element{
@include before("data-currency"){
font-size: .8em;
color: red;
};
}.element::before {
content: attr(data-currency);
font-size: 0.8em;
color: red;
}