bem
variables
element-separator
$element-separator: '__' !default;
Used by
Author
Atanas Atanasov scriptex.bg@gmail.com
modifier-separator
$modifier-separator: '--' !default;
Used by
- [function]
contains-modifier
- [function]
get-block
- [mixin]
m
Author
Atanas Atanasov scriptex.bg@gmail.com
functions
[private] contains-modifier
@function contains-modifier($selector) { ... }
Description
Check if a selector contains modifier
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$selector | — none | String | — none |
Returns
Boolean
Requires
- [variable]
modifier-separator
- [function]
selector-to-string
Used by
- [mixin]
e
Author
Atanas Atanasov scriptex.bg@gmail.com
[private] selector-to-string
@function selector-to-string($selector) { ... }
Description
Convert selector to string
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$selector | — none | String | — none |
Returns
String
Used by
- [function]
contains-modifier
- [function]
get-block
Author
Atanas Atanasov scriptex.bg@gmail.com
[private] get-block
@function get-block($selector) { ... }
Description
Get the block from a selector
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$selector | — none | String | — none |
Returns
String
Requires
- [variable]
modifier-separator
- [function]
selector-to-string
Used by
- [mixin]
e
Author
Atanas Atanasov scriptex.bg@gmail.com
mixins
b
@mixin b($element) { ... }
Description
Create a block from element
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$element | — none | String | — none |
Example
// Input
@include b(block) {
background: red;
@include e(header){
font-size: 14px;
@include m(css) {
font-size: 18px;
}
};
}
// Output
.block {
background: red;
}
.block__header {
font-size: 14px;
}
.block__header--css {
font-size: 18px;
}
Author
Atanas Atanasov scriptex.bg@gmail.com
e
@mixin e($element) { ... }
Description
Create an element from element
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$element | — none | String | — none |
Example
// Input
@include b(block) {
background: red;
@include e(header){
font-size: 14px;
@include m(css) {
font-size: 18px;
}
};
}
// Output
.block {
background: red;
}
.block__header {
font-size: 14px;
}
.block__header--css {
font-size: 18px;
}
Requires
- [variable]
element-separator
- [variable]
element-separator
- [function]
contains-modifier
- [function]
get-block
Author
Atanas Atanasov scriptex.bg@gmail.com
m
@mixin m($element) { ... }
Description
Create a modifier from element
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$element | — none | String | — none |
Example
// Input
@include b(block) {
background: red;
@include e(header){
font-size: 14px;
@include m(css) {
font-size: 18px;
}
};
}
// Output
.block {
background: red;
}
.block__header {
font-size: 14px;
}
.block__header--css {
font-size: 18px;
}
Requires
- [variable]
modifier-separator
Author
Atanas Atanasov scriptex.bg@gmail.com
helpers
mixins
aspect-ratio
@mixin aspect-ratio($shape: rect) { ... }
Description
Specifies aspect ratio for an element
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$shape | The shape of the aspect ratio. | Rect or Square | rect |
Example
@include aspect-ratio(rect);
@include aspect-ratio(square);
Links
Author
Atanas Atanasov scriptex.bg@gmail.com
auto-grid
@mixin auto-grid($min-size: 16rem, $gap: 1rem) { ... }
Description
Progressively enhanced, fully responsive grid layout without any media queries using CSS Grid
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$min-size | Minimum size of a grid column. | Number | 16rem |
$gap | Space between grid columns. | Number | 1rem |
Example
@include auto-grid(16rem, 1rem);
Links
Author
Atanas Atanasov scriptex.bg@gmail.com
font-size
@mixin font-size($size, $rem: 16) { ... }
Description
Set font size in REMs and provide PX fallback
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$size | Font size in pixels. | Number | — none |
$rem | REM font size in pixels. | Number | 16 |
Example
@include font-size(20);
@include font-size(20, 12);
Links
Author
Atanas Atanasov scriptex.bg@gmail.com
full-bleed
@mixin full-bleed() { ... }
Description
Make an element get the full browser width
Parameters
None.
Example
@include full-bleed;
Author
Atanas Atanasov scriptex.bg@gmail.com
grid
@mixin grid($items: 4, $gutter: $grid-gutter) { ... }
Description
A responsive grid based on CSS Flexbox layout including different sizes based on device width.
This mixin uses several predefined variables which can be modified:
$grid-cols: 12
- maximum number of columns in the grid.
$grid-sizes: 1, 2, 3, 4, 6
- list of sizes of the columns in the grid.
$grid-gutter: 16px
- spacing between columns in the grid.
$grid-element: '.o-grid'
- selector for the grid element.
$grid-output-css: true
- boolean which indicates if CSS should be outputted.
$grid-breakpoints
- a map of named media query breakpoints.
(
'small': 0px,
'medium': 768px,
'large': 1024px
)
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$items | Number of items per row | Number | 4 |
$gutter | Spacing between items | Number | $grid-gutter |
Example
@include grid(4, 12);
Requires
- [function]
grid-item-width
- [variable]
grid-cols
Links
Author
Atanas Atanasov scriptex.bg@gmail.com
loader
@mixin loader($svg: $loader, $repeat: no-repeat, $position: 50% 50%, $size: 2rem 2rem) { ... }
Description
An animated SVG loader A default variable $loader
is available. Looks like this:
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$svg | Valid SVG image code. | String | $loader |
$repeat | Background repeat value. | String | no-repeat |
$position | Background position value. | Number | 50% 50% |
$size | Background size value. | Number | 2rem 2rem |
Example
@include loader;
@include loader($your-svg-string, no-repeat, 0 0, 3rem 1rem);
Requires
- [mixin]
background-svg
Author
Atanas Atanasov scriptex.bg@gmail.com
rainbow
@mixin rainbow($colors, $stops, $direction: horizontal) { ... }
Description
Create a single background image using CSS gradients without blur between color stops.
This can be achieved with a single linear-gradient, but only Firefox will render it properly.
All other browsers will blur the edges of the stops.
This mixin uses two maps - one with colors and one with color stops.
It is important to know the keys of both maps should be the same.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$colors | Map with named colors. | Map | — none |
$stops | Map with names color stops. | Map | — none |
$direction | Direction of the gradient. | Horizontal or Vertical | horizontal |
Example
@include rainbow(
$colors: (
'blue': blue,
'green': green,
'orange': orange,
'purple': purple,
'red': red
),
$stops: (
'blue': 30%,
'green': 45%,
'orange': 62%,
'purple': 87%,
'red': 100%
),
horizontal
);
Links
Author
Atanas Atanasov scriptex.bg@gmail.com
scroll-shadow
@mixin scroll-shadow($background: #fff, $color: #000, $size: 5) { ... }
Description
Create a scrolling shadow as explained in http://lea.verou.me/2012/04/background-attachment-local/
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$background | HEX background color. | String | #fff |
$color | HEX color. | String | #000 |
$size | Size of the shadow. | Number | 5 |
Example
@include scroll-shadow(#000, #fff, 4);
Links
Author
Atanas Atanasov scriptex.bg@gmail.com
select
@mixin select($text-color: #444, $border-color: #444, $background-color: #fff, $shadow-color: #000) { ... }
Description
Cross browser mixin for native select field style.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$text-color | HEX color for the text. | String | #444 |
$border-color | HEX color for the border. | String | #444 |
$background-color | HEX color for the background. | String | #fff |
$shadow-color | HEX color for the box shadow. | String | #000 |
Example
@include select(#222, #333, #fafafa, #000);
Requires
- [variable]
triangle-before
- [variable]
triangle-after
- [function]
svg-url
Links
Author
Atanas Atanasov scriptex.bg@gmail.com
text-truncate
@mixin text-truncate($overflow-style: ellipsis) { ... }
Description
Keep a line of text on a single line and add ellipsis if the text overflows.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$overflow-style | Value for the text-overflow property. | String | ellipsis |
Example
@include text-truncate;
@include text-truncate(clip);
Author
Atanas Atanasov scriptex.bg@gmail.com
triangle
@mixin triangle($size: 2rem, $background: red, $radius: true) { ... }
Description
A triangle with (or without) rounded corners
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$size | Width and height of the triangle. | Number | 2rem |
$background | Background of the triangle. | String | red |
$radius | Enable/disable border radius. | Boolean | true |
Example
@include font-size(20);
@include font-size(20, 12);
Links
Author
Atanas Atanasov scriptex.bg@gmail.com
unbreak
@mixin unbreak($hyphens: auto) { ... }
Description
Prevent text from flowing out of its container
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$hyphens | Value for the hyphens property. | None or Manual or Auto | auto |
Example
@include unbreak;
@include unbreak(none);
Author
Atanas Atanasov scriptex.bg@gmail.com
variables
grid-cols
$grid-cols: 12 !default;
Used by
- [function]
grid-item-width
- [mixin]
grid
grid-sizes
$grid-sizes: 1, 2, 3, 4, 6 !default;
grid-gutter
$grid-gutter: 16px !default;
Used by
- [function]
grid-item-width
- [function]
grid-item-width
grid-element
$grid-element: '.o-grid' !default;
grid-output-css
$grid-output-css: false !default;
grid-breakpoints
$grid-breakpoints: (
'small': 0px,
'medium': 768px,
'large': 1024px
) !default;
loader
$loader: '<svg width="100" height="100" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#000"><g fill="none" fill-rule="evenodd"><g transform="translate(1 1)" stroke-width="2"><circle stroke-opacity=".5" cx="18" cy="18" r="18"></circle><path d="M36 18c0-9.94-8.06-18-18-18" transform="rotate(0 18 18)"><animateTransform attributeName="transform" type="rotate" from="0 18 18" to="360 18 18" dur="1.5s" repeatCount="indefinite"></animateTransform></path></g></g></svg>' !default;
triangle-before
$triangle-before: '<svg width="19" height="11" viewBox="0 0 19 11"><path fill="';
Used by
- [mixin]
select
triangle-after
$triangle-after: '" d="M18.6067065,0.422572289 C18.3723515,0.182891566 18.0945495,0.0631506024 17.7735597,0.0631506024 L1.18500341,0.0631506024 C0.863883959,0.0631506024 0.586276451,0.182891566 0.351726962,0.422572289 C0.117177474,0.662518072 0,0.946198795 0,1.27414458 C0,1.6020241 0.117177474,1.88570482 0.351726962,2.12545181 L8.64603754,10.6012169 C8.88084642,10.8408976 9.15845392,10.9609036 9.47931399,10.9609036 C9.80017406,10.9609036 10.078041,10.8408976 10.3123959,10.6012169 L18.6067065,2.12538554 C18.8409966,1.88570482 18.958628,1.6020241 18.958628,1.27407831 C18.958628,0.946198795 18.8409966,0.662518072 18.6067065,0.422572289 Z"/></svg>';
Used by
- [mixin]
select
functions
[private] grid-item-width
@function grid-item-width() { ... }
Parameters
None.
Requires
- [variable]
grid-cols
- [variable]
grid-gutter
- [variable]
grid-gutter
Used by
- [mixin]
grid
tools
variables
asset-base-path
$asset-base-path: '../assets' !default;
Description
Base path for assets (fonts, images...), should not include trailing slash
Type
String
Used by
- [function]
asset
breakpoints
$breakpoints: (
'phone': 320px,
'phone-wide': 480px,
'phablet': 560px,
'tablet-small': 640px,
'tablet': 768px,
'tablet-wide': 1024px,
'desktop': 1280px,
'desktop-wide': 1440px
) !default;
Used by
sides
$sides: (top, bottom, left, right, all) !default;
Used by
- [mixin]
spacing-helpers
spaceamounts
$spaceamounts: (0, 10, 20, 30, 50) !default;
Used by
- [mixin]
spacing-helpers
functions
[private] asset
@function asset($type, $file) { ... }
Description
Asset URL builder
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$type | Asset type, matching folder name | String | — none |
$file | Asset file name, including extension | String | — none |
Returns
Url
—A url()
function leading to the asset
Requires
- [variable]
asset-base-path
Used by
image
@function image($file) { ... }
Description
Image asset helper
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$file | Asset file name, including extension | String | — none |
Returns
Url
—A url()
function leading to the image
Requires
- [function]
asset
font
@function font($file) { ... }
Description
Font asset helper
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$file | Asset file name, including extension | String | — none |
Returns
Url
—A url()
function leading to the font
Requires
- [function]
asset
half-negative-number
@function half-negative-number($num) { ... }
Description
Get the half and negative value of a given number
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$num | A number | Number | — none |
Example
.element {
$size: 100px;
width: $size;
top: half-negative-number($size);
}
Requires
- [function]
half-number
- [function]
negative-number
Author
Atanas Atanasov scriptex.bg@gmail.com
half-number
@function half-number($num) { ... }
Description
Get the half of a given number
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$num | A number | Number | — none |
Example
.element {
$size: 100px;
width: $size;
height: half-number($size);
}
Used by
- [function]
half-negative-number
Author
Atanas Atanasov scriptex.bg@gmail.com
negative-number
@function negative-number($num) { ... }
Description
Get the negative value of a given number
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$num | A number | Number | — none |
Example
.element {
$size: 100px;
width: $size;
top: negative-number($size);
}
Used by
- [function]
half-negative-number
Author
Atanas Atanasov scriptex.bg@gmail.com
shade
@function shade($color, $percentage) { ... }
Description
Slightly darken a color
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$color | Valid CSS color | String | — none |
$percentage | Weight of the darkening | Number | — none |
Example
shade(#444, 20%)
shade($theme-color, 50%)
Author
Atanas Atanasov scriptex.bg@gmail.com
str-replace
@function str-replace($string, $search, $replace: '') { ... }
Description
Replace a string in another string
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$string | String to search in. | String | — none |
$search | String to search for. | String | — none |
$replace | String to replace with. | String | '' |
Returns
String
—The replaced string.
Example
str-replace('hello world', 'world', 'people');
Used by
- [function]
svg-url
Author
Atanas Atanasov scriptex.bg@gmail.com
svg-url
@function svg-url($svg) { ... }
Description
URL encode a valid SVG string
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$svg | Valid SVG image code. | String | — none |
Example
svg-url($svg);
Requires
- [function]
str-replace
Used by
- [mixin]
select
- [mixin]
multi-background-svg
- [mixin]
background-svg
Author
Atanas Atanasov scriptex.bg@gmail.com
tint
@function tint($color, $percentage) { ... }
Description
Slightly lighten a color
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$color | Valid CSS color | String | — none |
$percentage | Weight of the lightening | Number | — none |
Example
tint(#444, 20%)
tint($theme-color, 50%)
Author
Atanas Atanasov scriptex.bg@gmail.com
to-boolean
@function to-boolean($value) { ... }
Description
Convert a value to boolean
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$value | Any kind of value | Any | — none |
Example
to-boolean(0) // false
to-boolean(false) // false
to-boolean(null) // false
to-boolean("") // false
to-boolean(()) // false
to-boolean(1) // true
to-boolean(true) // true
to-boolean("abc") // true
to-boolean(0 1 2) // true
to-boolean((a: 1, b: 2) // true
Used by
- [mixin]
spacing-helpers
Author
Atanas Atanasov scriptex.bg@gmail.com
v
@function v($var, $fallback: null) { ... }
Description
A function to speed up and simplify usage of CSS custom properties in SCSS
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$var | Name of a CSS custom property with the leading dashes. | String | — none |
$fallback | CSS custom property fallback | String or Null | null |
Example
:root {
--theme-color: red;
}
body { color: v(theme-color); }
p { color: v(theme-color, #ff0); }
Author
Atanas Atanasov scriptex.bg@gmail.com
z
@function z($name, $list) { ... }
Description
Easy z-index management based on list of element names
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$name | Name of the element. | String | — none |
$list | List of element names. | List | — none |
Example
$z-indexes: ('modal', 'site-nav', 'site-header', 'site-content', 'site-footer');
// Usage:
.modal { z-index: z(modal); }
.site-nav { z-index: z(site-nav); }
.site-header { z-index: z(site-header); }
.site-content { z-index: z(site-content); }
.site-footer { z-index: z(site-footer; }
// Output
.modal { z-index: 5; }
.site-nav { z-index: 4; }
.site-header { z-index: 3; }
.site-content { z-index: 2; }
.site-footer { z-index: 1; }
Links
Author
Atanas Atanasov scriptex.bg@gmail.com
mixins
hover
@mixin hover() { ... }
Description
Enable hover states on devices which support hover media feature and on IE10 and IE11
Detailed info about the Hover CSS Media Feature can be found here. This media query is implemented in almost all modern browsers and works as expected.
The modern browsers include Chrome, Opera, Safari, Edge, Brave, Vivaldi, etc.
Internet Explorer and Firefox do not understand this media feature and therefore will simply ignore all rules inside the query.
Parameters
None.
Example
@include hover { };
Author
Atanas Atanasov scriptex.bg@gmail.com
mq
@mixin mq($breakpoint, $type: min, $breakpoints: $breakpoints) { ... }
Description
Get a media query for a given breakpoint. A predefined map of breakpoints is available and can be modified:
$breakpoints: (
'phone': 320px,
'phone-wide': 480px,
'phablet': 560px,
'tablet-small': 640px,
'tablet': 768px,
'tablet-wide': 1024px,
'desktop': 1280px,
'desktop-wide': 1440px
);
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$breakpoint | A key from the | String | — none |
$type | "min" makes it mobile-first, "max" makes it desktop-first. | Min or Max | min |
$breakpoints | A map of named breakpoints. | Map | $breakpoints |
Example
@include mq(phone);
@include mq(tablet, max, $breakpoints);
Requires
- [variable]
breakpoints
- [variable]
breakpoints
Author
Atanas Atanasov scriptex.bg@gmail.com
reset
@mixin reset($all: true, $box-sizing: true, $image: true, $table: true, $textarea: true, $contenteditable: true) { ... }
Description
A modern CSS reset
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$all | If | Boolean | true |
$box-sizing | If | Boolean | true |
$image | If | Boolean | true |
$table | If | Boolean | true |
$textarea | If | Boolean | true |
$contenteditable | If | Boolean | true |
Example
@include reset();
@include reset($all: true, $box-sizing: true, $image: true, $table: true, $textarea: true, $contenteditable: false);
Author
Atanas Atanasov scriptex.bg@gmail.com
spacing-helpers
@mixin spacing-helpers($sides: $sides, $spaceamounts: $spaceamounts, $paddingPrefix, $marginPrefix, $shorten: false) { ... }
Description
Generates padding and margin helpers classes
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$sides | List with sides. | List | $sides |
$spaceamounts | List with numbers. | List | $spaceamounts |
$paddingPrefix | Prefix for padding classes. If falsy, no padding classes will be generated. | String | — none |
$marginPrefix | Prefix for margin classes. If falsy, no margin classes will be generated. | String | — none |
$shorten | If true, the first letter of each side is used. Otherwise the full side is used. | Boolean | false |
Example
@include spacing-helpers($sides, $spaceamounts, 'padding', '', false);
Requires
- [variable]
spaceamounts
- [variable]
sides
- [function]
to-boolean
Links
Author
Atanas Atanasov scriptex.bg@gmail.com
multi-background-svg
@mixin multi-background-svg($backgrounds) { ... }
Description
Create a CSS multiple background declaration out of multiple SVG backgrounds
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$backgrounds | List of SVG strings | List | — none |
Example
@include multi-background-svg($svg1, $svg2, ...);
Requires
- [function]
svg-url
Author
Atanas Atanasov scriptex.bg@gmail.com
background-svg
@mixin background-svg($svg, $repeat: no-repeat, $position: 0 0, $size: 100% 100%) { ... }
Description
Create a CSS background declaration out of any valid SVG code
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$svg | Valid SVG image code. | String | — none |
$repeat | Background repeat value. | String | no-repeat |
$position | Background position value. | Number | 0 0 |
$size | Background size value. | Number | 100% 100% |
Example
@include background-svg($svg, repeat-x, 50% 50%, cover);
Requires
- [function]
svg-url
Used by
- [mixin]
loader
Author
Atanas Atanasov scriptex.bg@gmail.com