{"componentChunkName":"component---src-templates-post-jsx","path":"/css-audit-with-parker/","result":{"data":{"contentfulPost":{"title":"CSS audit with Parker","slug":"css-audit-with-parker","metaDescription":{"internal":{"content":"CSS audit with Park"}},"publishDate":"June 06, 2016","publishDateISO":"2016-06-06","tags":[{"title":"CSS","id":"db2640d0-836a-5b08-b9c6-eead4aadc9bc","slug":"css"},{"title":"Performance","id":"d7a7c8c4-e306-53c5-a10d-348f33697e1d","slug":"performance"},{"title":"Development","id":"0394a67a-444d-51e8-82b0-704a5902de62","slug":"development"}],"heroImage":{"title":"sailing-around-the-bay","fluid":{"aspectRatio":1.5100671140939597,"src":"/archive/v3/ctf/28f0ee4123a82b23.jpg","srcSet":"/archive/v3/ctf/c73bfb0cb076f919.jpg 450w,\n/archive/v3/ctf/a5309c870cb16245.jpg 900w,\n/archive/v3/ctf/5b41f2341f78844f.jpg 1800w","srcWebp":"/archive/v3/ctf/fd97ca9aea400033.webp","srcSetWebp":"/archive/v3/ctf/4ba9f255eaf40cac.webp 450w,\n/archive/v3/ctf/ad814d61e4d38a3f.webp 900w,\n/archive/v3/ctf/258b4c55c3aecc37.webp 1800w","sizes":"(max-width: 1800px) 100vw, 1800px"},"ogimg":{"src":"/archive/v3/ctf/28f0ee4123a82b23.jpg","width":1800,"height":1192}},"body":{"childMarkdownRemark":{"timeToRead":3,"html":"<p>While reading Harry Roberts’ article <a href=\"http://csswizardry.com/2016/06/improving-your-css-with-parker/\">Improving Your CSS with Parker</a>, I decided I’d follow along by auditing this very site to see what I could improve. While this is only a small portfolio/blog site, I still wanted to see what CSS improvements I could be making since I use the same base CSS framework on every project. I’m just using this post to document each metric and explain what I should be doing to improve my score. For a more in-depth explanation of Parker and each metric you should head over to the <a href=\"https://github.com/katiefenn/parker\">docs</a>.</p>\n<h3 id=\"total-stylesheets\" style=\"position:relative;\"><a href=\"#total-stylesheets\" aria-label=\"total stylesheets permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Total Stylesheets</h3>\n<p>Auditing one stylesheet, main.css</p>\n<h3 id=\"total-stylesheet-size\" style=\"position:relative;\"><a href=\"#total-stylesheet-size\" aria-label=\"total stylesheet size permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Total Stylesheet Size</h3>\n<p><strong>42990 bytes, or 42.99 KB</strong>. Not bad, seeing that the average stylesheet size is 76 KB. Then again, this is a small portfolio site. Maybe it’s time for a refractor?</p>\n<h3 id=\"total-rules-selectors-identifiers-and-declarations\" style=\"position:relative;\"><a href=\"#total-rules-selectors-identifiers-and-declarations\" aria-label=\"total rules selectors identifiers and declarations permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Total Rules, Selectors, Identifiers, and Declarations</h3>\n<p>I had to do a quick Google search to find out the difference between a selector and identifier. Here’s a crude drawing of the anatomy of a CSS rule.</p>\n<p><img src=\"/archive/v3/ctf/9b7b4a4fdc282264.jpg\" alt=\"css-rule\"></p>\n<p><code class=\"language-text\">Rules = 517</code>\n<code class=\"language-text\">Selectors = 589</code>\n<code class=\"language-text\">Identifiers = 918</code>\n<code class=\"language-text\">Declarations = 1447</code></p>\n<p>Harry also defines a custom metric by dividing <strong>Total Declarations</strong> by <strong>Total Rules</strong>, which gives us the average Declarations Per Ruleset. The lower this number is, the better. I’m content with my ~2.8 number.</p>\n<p><strong>Declartions Per Ruleset = 2.798839458</strong></p>\n<h3 id=\"selectors-per-rule\" style=\"position:relative;\"><a href=\"#selectors-per-rule\" aria-label=\"selectors per rule permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Selectors Per Rule</h3>\n<p><code class=\"language-text\">1.1392649903288201</code>. Doing good here, I just need to completely move away from the few @extends I use and use single-purpose classes instead of attaching multiple selectors to the same declarations, e.g. grouping all the various input types to the same CSS declarations.</p>\n<h3 id=\"identifiers-per-selector\" style=\"position:relative;\"><a href=\"#identifiers-per-selector\" aria-label=\"identifiers per selector permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Identifiers Per Selector:</h3>\n<p><code class=\"language-text\">1.7351443123938879</code>. Don’t nest classes to maintain a score between 1 and 2.</p>\n<h3 id=\"specificity-per-selector\" style=\"position:relative;\"><a href=\"#specificity-per-selector\" aria-label=\"specificity per selector permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Specificity Per Selector:</h3>\n<p><code class=\"language-text\">10.750424448217318</code>. Harry explains the specificity rating for this metric. Anything near a 10 is excellent, but don’t ever go over 20.\nTop Selector Specificity:</p>\n<ol start=\"41\">\n<li>Ouch, I can explain..</li>\n</ol>\n<h3 id=\"top-selector-specificity-selector\" style=\"position:relative;\"><a href=\"#top-selector-specificity-selector\" aria-label=\"top selector specificity selector permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Top Selector Specificity Selector:</h3>\n<p><code class=\"language-text\">.post__title a:visited~.post__status:after</code>. This one was necessary. I was shooting for the neat, CSS-only unread post status and it required a hefty selector.</p>\n<h3 id=\"total-id-selectors\" style=\"position:relative;\"><a href=\"#total-id-selectors\" aria-label=\"total id selectors permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Total Id Selectors:</h3>\n<p><code class=\"language-text\">0</code>. All the cool kids <strong>DON’T</strong> use ID selectors.</p>\n<h3 id=\"total-unique-colors\" style=\"position:relative;\"><a href=\"#total-unique-colors\" aria-label=\"total unique colors permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Total Unique Colors:</h3>\n<p><code class=\"language-text\">13</code>. Lucky 13.</p>\n<h3 id=\"unique-colors\" style=\"position:relative;\"><a href=\"#unique-colors\" aria-label=\"unique colors permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Unique Colors:</h3>\n<p><code class=\"language-text\">#FFFF00, #000000, #FFFFFF, #515554, #009688, #FF9800, #CFD2D2, #ACACAC, #F1F1F1, #E74C3C, #F1C40F, #2980B9, #27AE60</code></p>\n<h3 id=\"total-important-keywords\" style=\"position:relative;\"><a href=\"#total-important-keywords\" aria-label=\"total important keywords permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Total Important Keywords:</h3>\n<p><code class=\"language-text\">50</code>. All important declarations are attached to utility helpers.</p>\n<h3 id=\"total-media-queries\" style=\"position:relative;\"><a href=\"#total-media-queries\" aria-label=\"total media queries permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Total Media Queries:</h3>\n<p><code class=\"language-text\">14</code></p>\n<h3 id=\"media-queries\" style=\"position:relative;\"><a href=\"#media-queries\" aria-label=\"media queries permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Media Queries:</h3>\n<p><code class=\"language-text\">(min-width:0em), (min-width:37.5em), (min-width:64em), screen and (max-width:47.999375em), screen and (min-width:34.375em), screen and (min-width:20em), screen and (min-width:48em), screen and (min-width:64em), screen and (min-width:78.5em), screen and (min-width:100em), screen and (max-width:78.499375em), screen and (max-width:19.999375em), screen and (max-width:34.374375em), screen and (max-width:63.999375em)</code></p>","excerpt":"While reading Harry Roberts’ article Improving Your CSS with Parker, I decided I’d follow along by auditing this very site to see what I could improve. While this is only a small portfolio/blog site, I still wanted to see what CSS improvements I could be making since I use the same base CSS framework on every project…"}}}},"pageContext":{"slug":"css-audit-with-parker","prev":{"slug":"temporary-2020-site-update","publishDate":"2020-05-25"},"next":{"slug":"practical-use-cases-for-the-picture-element","publishDate":"2016-02-01"}}},"staticQueryHashes":[]}