Created
March 22, 2018 11:30
-
-
Save E314c/05b567bce90699fe50c0d65bd4f933c1 to your computer and use it in GitHub Desktop.
A style to catch "undefined" styles in modern webapps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* In this modern world of webpacking and importing styles into your javascript | |
to make use of CSS modules, you sometimes end up asking for a style that just doesn't exist. | |
Thus, your component ends up with `undefined` in it's class definition. | |
At best, it's no noticable effect. | |
At worst, you're missing key styling you thought you had because of a typo in your JS. | |
This snippet just adds a style to `.undefined`, highlighting them on your screen for ease. | |
*/ | |
:global(.undefined) { //marked global because you should be using CSSModules | |
background-color: #FF7b93; | |
border: thick solid red; | |
&::before{ | |
position:fixed; | |
top: 10px; | |
left: 10px; | |
display: block; | |
content: 'An undefined style exists on your page!'; | |
padding: 10px; | |
color: white; | |
background-color: rgba(0,0,0,0.5); | |
border: thin solid red; | |
font-size: 2rem; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment