-
Notifications
You must be signed in to change notification settings - Fork 0
/
_module-naming-helpers.scss
108 lines (87 loc) · 1.78 KB
/
_module-naming-helpers.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
* bemify [modified for Kickoff]
* =================================
* https://github.com/franzheidl/bemify
* Franz Heidl 2015
*
* Usage: https://gist.github.com/mrmartineau/0cd2010bf265d712bafb
*/
// CONFIG
// ======
// Output combined state selectors like:
// .block-element.is-active {}
// Set to false to output single, non-combined state modifiers:
// .block-element--is-active {}
$combined-state-selectors: true;
// .block[separator]element:
$element-separator: "-";
// .block[separator]modifier:
$modifier-separator: "--";
// The default prefix for state modifier selectors, will be combined with $modifier-separator:
$state-prefix: "is";
// Mixins
// @include ko-block('form') {}
@mixin ko-block($name) {
.#{$name} {
@content;
}
}
// @include ko-element('item') {}
@mixin ko-element($name) {
@at-root {
&#{$element-separator}#{$name} {
@content;
}
}
}
// @include ko-modifier('stacked') {}
@mixin ko-modifier($name) {
@at-root {
&#{$modifier-separator}#{$name} {
@content;
}
}
}
// @include ko-state('active') {}
// @include ko-state('nav', 'has') {}
@mixin ko-state($state, $prefix: $state-prefix) {
@if $combined-state-selectors == true {
@at-root {
&.#{$prefix}-#{$state} {
@content;
}
}
}
@else {
@at-root {
&#{$modifier-separator}#{$prefix}-#{$state} {
@content;
}
}
}
}
// Aliases
// @include ko-component('form') {}
@mixin ko-component($name) {
@include ko-block($name) {
@content;
}
}
// @include ko-child('item') {}
@mixin ko-child($name) {
@include ko-element($name) {
@content;
}
}
// @include ko-subcomponent('item') {}
@mixin ko-subcomponent($name) {
@include ko-element($name) {
@content;
}
}
// @include ko-sub('item') {}
@mixin ko-sub($name) {
@include ko-element($name) {
@content;
}
}