{"id":256289,"date":"2017-07-06T06:38:08","date_gmt":"2017-07-06T13:38:08","guid":{"rendered":"http:\/\/css-tricks.com\/?p=256289"},"modified":"2017-09-22T13:10:11","modified_gmt":"2017-09-22T20:10:11","slug":"options-programmatically-documenting-css","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/options-programmatically-documenting-css\/","title":{"rendered":"The Options for Programmatically Documenting CSS"},"content":{"rendered":"

I strongly believe that the documentation should be kept as close to the code as possible. Based on my experience, that’s the only option that works well in the long term. External documents, notes, and wikis all eventually get outdated, forgotten, and lost.<\/p>\n

Documentation is a topic that always bugs me. Working on poorly documented codebase is a ticking bomb. It makes the onboarding process a tedious experience. Another way to think of bad documentation is that it helps foster a low truck factor<\/a> (that is, “the number of people on your team who have to be hit by a truck before the project is in serious trouble”). <\/p>\n

Recently I was on-boarded into a project with more than 1,500 pages of documentation written in\u2026 Microsoft Word. It was outdated and unorganized. A real disaster. There must be a better way!<\/p>\n

I’ve talked about this documentation issue before. I scratched the surface not long ago here on CSS-Tricks in my article What Does a Well-Documented CSS Codebase Look Like?<\/a> Now, let’s drill down into the options for programmatically<\/em> documenting code. Specifically CSS.<\/p>\n

<\/p>\n

Similar to JSDoc<\/a>, in the CSS world there are a couple of ways to describe your components right in the source code as \/* comments *\/<\/code>. Once code is described through comments like this, a living style guide<\/strong> for the project could be generated. I hope I’ve stressed enough the word living<\/strong> since I believe that’s the key for successful maintenance. Based on what I’ve experienced, there are a number of benefits to documenting code in this way that you experience immediately:<\/p>\n