Skip to content

Commit e561dd5

Browse files
committed
added a bit of a readme
1 parent a97507b commit e561dd5

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

README.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,51 @@
1-
# postcss-modules-constants
1+
# CSS Modules: Constants
2+
23
Pass 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.

0 commit comments

Comments
 (0)