Created
May 2, 2012 20:25
-
-
Save bencallahan/2580149 to your computer and use it in GitHub Desktop.
Responsive Retrofitting: CSS Loading: Option 2
This file contains hidden or 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
| <!-- | |
| This is a series of gists comparing options for how to load CSS for a large | |
| responsive retrofit. The requirements for this are as follows: | |
| 1. limit to one http request for CSS | |
| 2. keep the size of this CSS request as minimal as possible | |
| 3. serve only the original CSS to large resolutions (>= 980) | |
| 4. serve only the new "responsive" CSS to smaller resolutions (< 980) | |
| 5. serve only the original CSS to browsers that don't support media queries | |
| Because this is a retrofit, we're not touching the original CSS. So, smaller | |
| screen devices will have unique CSS. We can't touch the original CSS files, | |
| so we need to do this in a way that keeps these mutually exclusive. | |
| --> |
This file contains hidden or 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
| <html class="no-mediaquery no-js"> | |
| <head> | |
| <script src="/js/media-query-check.js"> | |
| <link rel="stylesheet" type="text/css" href="css/styles.css"> | |
| </head> | |
| </html> |
This file contains hidden or 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
| /* this is a SCSS file which aggregates the necessary components for all | |
| screens */ | |
| /* if JavaScript is disabled OR media queries aren't supported */ | |
| .no-mediaquery { | |
| @import "original"; | |
| } | |
| @media (max-width: 500px) { | |
| @import "small"; | |
| } | |
| @media (max-width: 979px) { | |
| @import "medium"; | |
| } | |
| @media (min-width: 980px) { | |
| @import "original"; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requirements: