File tree Expand file tree Collapse file tree 1 file changed +50
-1
lines changed Expand file tree Collapse file tree 1 file changed +50
-1
lines changed Original file line number Diff line number Diff line change 1- # postcss-modules-constants
1+ # CSS Modules: Constants
2+
23Pass arbitrary constants between your module files
4+
5+ ### Usage
6+
7+ ``` css
8+ /* colors.css */
9+ @value primary: #BF4040;
10+ @value secondary: #1F4F7F;
11+
12+ .text-primary {
13+ color : primary;
14+ }
15+
16+ .text-secondary {
17+ color : secondary;
18+ }
19+ ```
20+
21+ ``` css
22+ /* breakpoints.css */
23+ @value small: (max-width: 599px);
24+ @value medium: (min-width: 600px) and (max-width: 959px);
25+ @value large: (min-width: 960px);
26+ ```
27+
28+ ``` css
29+ /* my-component.css */
30+ @value colors: "./colors.css";
31+ @value primary, secondary from colors;
32+ @value small as bp-small, large as bp-large from "./breakpoints.css";
33+
34+ .header {
35+ composes : text-primary from colors;
36+ box-shadow : 0 0 10px secondary;
37+ }
38+
39+ @media bp-small {
40+ .header {
41+ box-shadow : 0 0 4px secondary;
42+ }
43+ }
44+ @media bp-large {
45+ .header {
46+ box-shadow : 0 0 20px secondary;
47+ }
48+ }
49+ ```
50+
51+ Note that the ` : ` in a ` @value ` definition is optional as to not break Sass.
You can’t perform that action at this time.
0 commit comments