<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mark Shuster on Medium]]></title>
        <description><![CDATA[Stories by Mark Shuster on Medium]]></description>
        <link>https://medium.com/@mshuster?source=rss-c0934b5ca9af------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xDJ39AZErwbTh72TfvPv2w.jpeg</url>
            <title>Stories by Mark Shuster on Medium</title>
            <link>https://medium.com/@mshuster?source=rss-c0934b5ca9af------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 00:59:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mshuster/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Million Little Pieces: Functional CSS in React]]></title>
            <link>https://medium.com/twitch-news/a-million-little-pieces-functional-css-in-react-9c2779873e67?source=rss-c0934b5ca9af------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c2779873e67</guid>
            <category><![CDATA[twitch]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Mark Shuster]]></dc:creator>
            <pubDate>Fri, 19 Jan 2018 19:04:00 GMT</pubDate>
            <atom:updated>2018-01-19T19:04:00.114Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sK-KbVjxLW3cEKHZnM07HQ.jpeg" /></figure><p>There have been a great many thoughts by thought-leaders thinking thoughts about the future of CSS in a JavaScript encapsulated world. A lot of those thoughts seem to portend the death of CSS as a wholly separate language to describe presentational relationships of various pieces of markup. And, to a large degree, many of those thought-thinkers are right. CSS and its importance in the new web ecosystem has evolved a lot in the past few years and not necessarily in a way that has been kind to the new frameworks on the block nor to the idea of an inheritance-based presentational layout language. Playing nice with React and CSS hasn’t always been F-U-N, but using JS and CSS together can at least be F-U-N[CTIONAL] and maybe a little bit easier.</p><h3>Thinking Thoughts on Functional CSS</h3><p>The purpose of this essay isn’t to convince you to adopt a functional CSS system, though I highly suggest you do. <a href="http://basscss.com/">BassCSS</a> is a good one. <a href="http://tachyons.io/">Tachyons</a> is another good one if you enjoy pain. <a href="https://tailwindcss.com/">Tailwind</a> is pretty fresh and new. <a href="http://solid.buzzfeed.com/">Solid</a> is a nice one, but I have to say that because I’m a contributor. There are a great many articles extolling the virtues of implementing a functional CSS system, so I won’t say much more about it here.</p><p>Okay, I lied, I will say a little more about functional CSS. Functional CSS is great because it prevents people from writing more CSS. And let me present the following argument:</p><blockquote>The best CSS you write is the CSS you don’t write.</blockquote><p>The functional approach enforces and maintains consistency across your product by paring things like type-scale, margins, paddings, and other things that you don’t want to be variable down to a very small set of options. At the same time, functional CSS keeps your dependencies down to a compact and performant singular CSS import. Further, you encounter fewer issues with regard to inheritance, specificity, and the collisions that result from CSS because each of your functional classes has one, and only one, CSS rule attached to it.</p><p>All this isn’t to say that functional CSS is infallible. Rather, <strong>the purpose of this exercise is to explore a way we can lessen the pain of implementing a functional CSS system when used in a React environment</strong>. These pain points are as summarized in bold as follows:</p><p><strong>Functional CSS relies on a large number of idiosyncratic class names whose documentation lives somewhere else (if at all). </strong>The correct application of which becomes esoteric knowledge.</p><pre>// Via Tachyons<br>&lt;article class=&quot;center mw5 mw6-ns hidden ba mv4&quot;&gt;<br>  &lt;h1 class=&quot;f4 bg-near-black white mv0 pv2 ph3&quot;&gt;Title of card&lt;/h1&gt;<br>  &lt;div class=&quot;pa3 bt&quot;&gt;<br>    &lt;p class=&quot;f6 f5-ns lh-copy measure mv0&quot;&gt;<br>    ....</pre><p><strong>Elements with functional CSS classes grow to become ultimately unreadable.</strong> This adversely affects code clarity and the developer experience.</p><pre>// Also via Tachyons<br>  &lt;a class=&quot;no-underline near-white bg-animate bg-near-black hover-bg-gray inline-flex items-center ma2 tc br2 pa2&quot; href=&quot;https://github.com/&quot; title=&quot;GitHub&quot;&gt;</pre><p><strong>There is no accountability in writing class names. </strong>Developers can, and will, apply completely contradictory functional classes to elements with unpredictable results.</p><pre>// This is all valid to write, but who knows what will render!<br>&lt;div className=&quot;mg0 mg1 mg2 flex flex-row flex-column block inline float-left float-right hide show&quot;&gt;<br>...</pre><p><strong>None of this is very React-y and the more you think in React, the stranger it will all feel. </strong>That’s because developers and designers who build in React, end up thinking in React and having to switch contexts to CSS and class names from a JS world will generate some cognitive friction.</p><p>This strange feeling has lead to a bunch of different ways to think about CSS in JavaScript and the evolution of solutions like Radium, Styled Components, Glamorous and <a href="https://github.com/tuchk4/awesome-css-in-js">many more</a>. All of these abstractions bring CSS closer to the components they describe (a good thing™!), and allow users to define UI via CSS properties (also a good thing™!). However, none of these solutions give you the consistency, portability, and performance of functional CSS.</p><p>Further, even though it’s not vogue right now, there is a lot of benefit to keeping your source of truth for UI presentation in a segregated Sass/SCSS/CSS environment due the fact that it’s highly portable. CSS defined in a modular (BEM/OOCSS) and/or functional way will also be able to serve legacy and other non-react web platforms well into the foreseeable future.</p><p>Finally, maybe you’re like <a href="https://polaris.shopify.com/">Shopify</a> or one of the many other organizations building React UI component libraries. In which case, all UI component configuration is done via properties and CSS and class names are even further removed from the common workflow. At that point, making developers and designers implement simple layout and text decoration via CSS is just cruel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0HYI-I9u3_UJI97OJgnM3Q.jpeg" /></figure><h3>Representing Functional CSS in React</h3><p>You don’t have to throw away a perfectly good, exhaustive, and performant functional CSS toolset to make it in a React-forward world. A lot of these functional principles actually translate even better into a modular, JavaScript environment.</p><p>We are no longer going to apply classnames to elements, nor write CSS as style strings in React components, instead the concern of the developer will be configuring components that represent proxies to our well-defined functional system that is either included as a root import dependency in your sass-loader or imported directly by any of the components that utilize it. This approach can apply to any available functional library or one that you define. We can thank our Senior Front-end Developer <a href="https://codepen.io/jpanter">James Panter</a> for pioneering this approach for us here at <a href="https://www.twitch.tv/p/jobs/">Twitch</a>.</p><p>These proxy components exist as metaphors described by:</p><ul><li>Layout — A component that concerns itself primarily with properties of spacing, alignment, display, and position.</li><li>StyledLayout — A component that inherits the properties of Layout and also can apply typographic and visual styles like font-size, color, background-color, emphasis, etc.</li><li>Text — A component that concerns itself with the display of text styles, but can also render as any chose element type (span, p, h1-h6) where the other components necessarily render as divs.</li><li>InjectLayout — A utility that doesn’t render an element but rather <em>injects</em> class names into any arbitrary element or component that has a className property.</li></ul><p>These are the metaphors that are working well for our team, but any set of component metaphors can be adopted as long as their configuration properties can proxy to existing functional classnames.</p><h4>What This Means in Practice</h4><p><strong>All functional classes are scoped to 3 components.</strong> StyledLayout, Layout/InjectLayout, and Text can be used to compose almost all feature UI in concert with common components like Button, Tab, etc.</p><p>The only remaining CSS is used for widths/heights<strong>.</strong> This is a bit of a an exaggeration. There are also rules that define custom animations, and rules that have to exist so that modifier-based inheritance can be respected on state-change. That said, there is nothing stopping you from allowing users to directly set width/height on Layout level elements, a path we’ve not yet pursued.</p><pre>// For example:<br>&lt;StyledLayout display={Display.InlineFlex} alignItems={AlignItems.Center} padding={2} border&gt;<br>  &lt;Text color={Color.Alt}&gt;I&#39;m a component composed entirely using functional CSS!&lt;/Text&gt;<br>&lt;/StyledLayout&gt;</pre><p><strong>CSS rules are exposed by a well-defined, documented API that can be accessed via intellisense/autocomplete.</strong> The implementation of these rules via configuration properties is enforced by TypeScript and keeps developers accountable while also holding their hand.</p><pre>// text/component.tsx<br>// Font sizes are exposed on the Text component via an enum<br>export enum FontSize {<br>  Size1 = 1,<br>  Size2,<br>  Size3,<br>  Size4,<br>  Size5,<br>  Size6,<br>  Size7,<br>  Size8,<br>}</pre><pre>// ...<br>// The are mapped to corresponding functional classes.<br>const TEXT_FONT_SIZE_CLASSES = {<br>  [FontSize.Size1]: &#39;font-size-1&#39;,<br>  [FontSize.Size2]: &#39;font-size-2&#39;,<br>  [FontSize.Size3]: &#39;font-size-3&#39;,<br>  [FontSize.Size4]: &#39;font-size-4&#39;,<br>  [FontSize.Size5]: &#39;font-size-5&#39;,<br>  [FontSize.Size6]: &#39;font-size-6&#39;,<br>  [FontSize.Size7]: &#39;font-size-7&#39;,<br>  [FontSize.Size8]: &#39;font-size-8&#39;,<br>};</pre><pre>// ...<br>// And applied within the component<br>if (props.fontSize) {<br>  classes[TEXT_FONT_SIZE_CLASSES[props.fontSize]] = true;<br>}</pre><pre>// ...<br>// my-feature/component.tsx<br>// The functional properties are then invoked in the feature component.</pre><pre>import { Text, FontSize } from &#39;text/component&#39;;</pre><pre>&lt;Text fontSize={FontSize.Size4}&gt;Hello World&lt;/Text&gt;</pre><p>Standardized APIs allow for complex composition of responsive rules:</p><pre>&lt;Layout<br>  display={Display.Flex}<br>  flexGrow={0}<br>  flexWrap={FlexWrap.NoWrap}<br>  margin={{ bottom: 2 }}<br>  breakpointExtraSmall={{<br>    alignSelf: AlignSelf.End,<br>    flexOrder: 1,<br>  }}<br>  breakpointLarge={{<br>    alignSelf: AlignSelf.Start,<br>    flexOrder: 2,<br>  }}<br>/&gt;</pre><p><strong>The source of truth remains in the functional system.</strong> Your key tools for composing UI remain portable to other platforms and consistent across your application ecosystem.</p><p><strong>You write more complex, composed UI in React while your CSS stays the same size.</strong> It works great at scale since adding more UI doesn’t increase the amount of CSS you add to the system.</p><p>CSS in JS is not a revolution, it is an evolution. Using functional CSS libraries in React may not seem obvious at first, but it has proven to be a tremendously useful approach that has allowed our teams to remain quick and consistent while building our products from millions of little pieces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9KNnJoy6XL4lOf7P7OMMcg.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c2779873e67" width="1" height="1" alt=""><hr><p><a href="https://medium.com/twitch-news/a-million-little-pieces-functional-css-in-react-9c2779873e67">A Million Little Pieces: Functional CSS in React</a> was originally published in <a href="https://medium.com/twitch-news">Twitch Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Tooling With Solid & Atom (or, making the IDE our BFF)]]></title>
            <link>https://medium.com/buzzfeed-design/design-tooling-with-solid-atom-or-making-the-ide-our-bff-d2b0035cf62d?source=rss-c0934b5ca9af------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2b0035cf62d</guid>
            <category><![CDATA[buzzfeed]]></category>
            <category><![CDATA[atom]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Mark Shuster]]></dc:creator>
            <pubDate>Tue, 19 Apr 2016 15:00:15 GMT</pubDate>
            <atom:updated>2016-04-19T15:35:15.701Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ted Goas on Twitter</h3><p>pic.twitter.com/voRzvFOBBu</p><p>Now that the debate over whether designers should code is settled, we should all move on to solving more important problems.</p><p>We can finally begin to ask, <strong>“How should designers code?”</strong> BuzzFeed has some really great opinions on that topic, which is <a href="https://medium.com/buzzfeed-design/introducing-solid-1c16b1bf4868">why we built Solid as our foundational CSS framework</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*-vSU2nzmNmRHSf_2FxsvOA.gif" /><figcaption>Me using Atom editor</figcaption></figure><p>Empowering designers with the means to code requires them to adopt development tools. Obviously, most development tools are built for engineers, but when designers code, <strong>coding tools are necessarily design tools</strong> and become fundamental to designers’ process. That ultimately means that the text editor or IDE (Integrated Development Environment) becomes central to that workflow.</p><p><strong>It’s about time we treat the IDE as a design tool</strong> and begin to use it in ways that fit our processes as designers.</p><h4>The Problem With Solid</h4><p>Solid is too perfect. As an <a href="https://medium.com/buzzfeed-design/how-i-learned-to-stop-worrying-and-love-the-atomic-class-98d6ccc45781">OOCSS atomic framework</a>, Solid is too good at doing what it is supposed to do. It has a plethora of prefixed classes that can get very messy to write and exceedingly difficult to remember. This is why the Solid team has invested so much time producing <a href="http://solid.buzzfeed.com/">human-readable documentation</a> for all the features included in the framework. Obviously, as the framework grows, so does the documentation and the reliance on that documentation. Designers that are less confident in their coding ability become overwhelmed at the sprawling complexity of implementing responsive-prefixed OOCSS classes. Developers used to a legacy HTML/CSS workflow find themselves buried under piles of documentation.</p><h3>Getting Friendly With Your IDE</h3><p>One way of getting at this problem from both ends of the designer/developer spectrum is to employ your IDE. This way <strong>we can try to help designers solve for systemic complexity while also helping developers establish mental models</strong> of how Solid should work.</p><h4>Maybe you have strong feelings for your IDE</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*L3hUI0-0nYprhldx4e2tgA.png" /></figure><p>Or, maybe you just use whatever is popular in your circle of designers or developers (many of us at BuzzFeed use SublimeText). I’m going to do something radical and suggest you try out <a href="http://atom.io/">Atom</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*YGUcDhPxmR-Wk_FTCLeB2A.jpeg" /></figure><blockquote>“Atom is a text editor that’s modern, approachable, yet hackable to the core — a tool you can customize to do anything but also use productively without ever touching a config file.” -The people at GitHub who made Atom</blockquote><p>My goal isn’t really to sell you on Atom, but using Atom as an IDE does open up a really big world of design tooling that was inaccessible to most people before now. I should also mention that It’s completely free, cross-platform, has a super simple plugin package manager, and is built on Node.js and Chromium. What you sacrifice for the marginal slowness of running your IDE on a quasi-JavaScript engine, you gain in the ability to script your coding interface in HTML, CSS, and JavaScript.</p><h3>AutoComplete Joins Your Squad</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*qbDPrIfKJXU0ne2XNL5CiA.gif" /></figure><p>Atom’s AutoComplete framework is lightyears beyond what other IDEs offer. By ever-so-gently smashing Solid’s CSS classes and variables into an autocomplete plugin,<strong> we are able to provide an instant way of recalling responsive classes and variable</strong>s, while providing quick context and links to relevant documentation right in your IDE.</p><p>Check it out at <a href="https://atom.io/packages/solid-completions">https://atom.io/packages/solid-completions</a> and install it directly into your Atom editor using the integrated package manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*DOL7sWmj769rF7_WRqxL0w.png" /></figure><p>The solid-completions plugin will autocomplete any classname in HTML-ish documents (including Mustache, Handlebars, etc) and will provide you with easy access to Sass variables in Sass/SCSS files. Just begin typing any part of the classname you would like to use and autocomplete will tell you what kind of Solid class it is and link you directly to the relevant documentation should you need more context.</p><h3>Getting Friendly With Your Framework</h3><p>Maybe you don’t want to use Solid, or maybe you have a favorite framework that you think can benefit from tight integration with your IDE. So, let’s get a little technical and talk about our general approach for creating an AutoComplete provider in Atom. Unfortunately, getting Solid into an autocomplete “provider” isn’t necessarily trivial, so here’s a few things that I did to make it easier along the way. I’m not going to go into too much detail here, but feel free poke around and clone the repo at <a href="https://github.com/buzzfeed/solid-completions">github.com/buzzfeed/solid-completions</a> to help make your own autocomplete provider based on your frameworks and preferences. If you’re still scratching your head, don’t hesitate to <a href="http://twitter.com/mshuster">get in touch</a>.</p><p>First, I’d recommend getting a little more familiar with the <a href="https://github.com/atom/autocomplete-plus/wiki/Provider-API">Atom autocomplete provider API docs on GitHub</a>. You’ll notice that Atom plugins are written in <a href="http://coffeescript.org/">CoffeeScript</a>. CoffeeScript compiles to JavaScript, so it’s totally acceptable to write plugins in JavaScript if it’s more your speed.</p><p>Then you’ll need to structure the data that you want your provider to serve. We did this by analyzing our SCSS and CSS files with <a href="https://github.com/postcss/postcss">PostCSS</a>. PostCSS is a stylesheet post-processor that’s commonly used to manipulate CSS after it has already passed through preprocessors like Sass and has been rendered into CSS. It’s incredibly powerful, but we like it because it constructs a walkable AST (abstract syntax tree) in JSON that you can use to extract all the rules in your CSS or Sass that you would like to serve as autocomplete phrases.</p><p>You’ll then have to define the scope to determine when the autocomplete provider will be serving suggestions to the user. For classes in an HTML document, your scope would look something like:</p><pre>.html .meta.tag.any .string.quoted</pre><p>However, be aware that this will trigger autocomplete on any attribute that has a value in quotes. To make sure you’re only triggering on class attributes, you’ll have to take a look at the current line your editor buffer and walk back to the nearest attribute.</p><p>Finally, when you build your array of suggestions, make use of the various properties in the suggestion object to include hints to the user about what the keyword does and how to use it. Our solution shows the Solid framework logo, along with a label indicating what the function of the class does. We also include a link to the relevant documentation for that class within the description field.</p><h3>Get Friendly With Your Fellow Designers and Developers</h3><p>Designing in code means one less level of abstraction for passing design artifacts between “designers” and “developers.” Having both sides of the spectrum work with the same tools creates many efficiencies, but <strong>there is also a big opportunity to build our own processes and workflows into extensible tools like Atom</strong> to allow for even greater learning, cooperation, and standardization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*d3TKqTryuYpNCh5MIQ3PEg.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2b0035cf62d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/buzzfeed-design/design-tooling-with-solid-atom-or-making-the-ide-our-bff-d2b0035cf62d">Design Tooling With Solid &amp; Atom (or, making the IDE our BFF)</a> was originally published in <a href="https://medium.com/buzzfeed-design">BuzzFeed Design</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>