Skip to content

Commit 5352aa3

Browse files
committed
Initial commit
0 parents  commit 5352aa3

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
end_of_line = lf
8+
indent_style = space
9+
indent_size = 2

index.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module.exports = function ({ addComponents, theme }) {
2+
const screens = theme('screens');
3+
const userStyles = theme('debugScreens.style', {});
4+
5+
const defaultPosition = ['bottom', 'left'];
6+
const position = theme('debugScreens.position', defaultPosition);
7+
const positionY = position[0] || defaultPosition[0];
8+
const positionX = position[1] || defaultPosition[1];
9+
10+
const components = {
11+
'.debug-screens::before': Object.assign({
12+
position: 'fixed',
13+
zIndex: '2147483647',
14+
[positionY]: '0',
15+
[positionX]: '0',
16+
padding: '.3333333em .5em',
17+
fontSize: '12px',
18+
lineHeight: '1',
19+
fontFamily: 'sans-serif',
20+
backgroundColor: '#000',
21+
color: '#fff',
22+
boxShadow: '0 0 0 1px #fff',
23+
content: `'screen: _'`,
24+
}, userStyles),
25+
};
26+
27+
Object.entries(screens).forEach(([screen]) => {
28+
components[`@screen ${screen}`] = {
29+
'.debug-screens::before': {
30+
content: `'screen: ${screen}'`,
31+
},
32+
};
33+
});
34+
35+
addComponents(components);
36+
}
37+

package.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "tailwindcss-debug-screens",
3+
"version": "0.1.0",
4+
"description": "A Tailwind CSS component that shows the currently active screen (responsive breakpoint).",
5+
"main": "index.js",
6+
"author": "Joren Van Hee",
7+
"license": "MIT",
8+
"peerDependencies": {
9+
"tailwindcss": "^1.0"
10+
}
11+
}

0 commit comments

Comments
 (0)