<?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 Markus Siering on Medium]]></title>
        <description><![CDATA[Stories by Markus Siering on Medium]]></description>
        <link>https://medium.com/@herrbertling?source=rss-f7210e1c274------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0BFFgiZGTHCBPQFbxvuOJA.jpeg</url>
            <title>Stories by Markus Siering on Medium</title>
            <link>https://medium.com/@herrbertling?source=rss-f7210e1c274------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 18:46:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@herrbertling/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[Could this be easier?]]></title>
            <link>https://medium.com/@herrbertling/could-this-be-easier-bbde8b16b056?source=rss-f7210e1c274------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbde8b16b056</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[simplicity]]></category>
            <dc:creator><![CDATA[Markus Siering]]></dc:creator>
            <pubDate>Tue, 13 Mar 2018 08:45:37 GMT</pubDate>
            <atom:updated>2018-03-14T07:37:53.909Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCDNwXuQ2eTInlU3cTnpiw.jpeg" /></figure><p>Reading “<a href="http://amzn.to/2p8ohX7">Tribe of Mentors</a>” from Tim Ferriss, I came across this question at the very beginning of the book:</p><blockquote>What would this look like if it were easy?</blockquote><p><em>(Check the sample chapter in which this quote appears — </em><a href="https://tim.blog/2017/10/03/tribe-of-mentors/"><em>he posted it in his blog</em></a><em>.)</em></p><p>I love this question. It lets you boil down various situations, projects, tasks to the very essence. It lets you remove any distracting thoughts. Any bloat. Any unnecessary bits you <em>think </em>you have to do to finish something.</p><p>Some weeks ago our team lead Daniel took a post-it and put it right next to our Kanban wall for everyone to see. It says: “Geht das auch einfacher?” which as you might guess means “Could this be simpler?”</p><p>His idea is probably completely unconnected to what Tim Ferriss wrote. It does connect to it quite a bit, though. It enforces questioning oneself.</p><p>Since then, I’ve noticed something amazing. When a discussion or a solution we deem necessary gets too complicated, one of us often points to the post-it. We take a step back and check whether we could solve whatever we are discussing in a simpler way:</p><ul><li>Do we really need this automatization?</li><li>Do we need to build a parser for some content? Or are we faster with manually typing things down?</li><li>Does it help to solve the most unlikely edge case or are we fine by solving what most people will need?</li><li>Is it worth the hassle to get Jenkins pipeline notifications in HipChat or is a simple email enough?</li><li>Do we need a breaking change in one of our design system components or can we find a simple way to avoid that?</li><li>Would the code be easier if we get rid of a rarely used, unmaintainable part?</li></ul><p>It’s interesting to see the power of such a simple measure. By putting up this “simplicity reminder”, we enhanced our conversations, our thinking and in the end our output.</p><p>We did not measure anything about this. Still, I am sure this small post-it made us a better team, made us produce better code. And I am pretty sure we will benefit even more from this simplicity in the long run.</p><p>So go ask yourself: <strong>Could this be easier?</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbde8b16b056" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Teaching a machine to convert wireframes into code]]></title>
            <link>https://tech.new-work.se/teaching-a-machine-to-convert-wireframes-into-code-f9333e125e61?source=rss-f7210e1c274------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9333e125e61</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[sketching]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[wireframe]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Markus Siering]]></dc:creator>
            <pubDate>Mon, 27 Nov 2017 14:48:55 GMT</pubDate>
            <atom:updated>2017-11-27T14:48:55.353Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57BR9DRqQbDQ6ycZMAeopA.jpeg" /></figure><p>Airbnb recently published an interesting blogpost: <a href="http://airbnb.design/sketching-interfaces/">Sketching Interfaces</a>. They trained an AI to generate code from low-fi wireframe sketches. The idea behind this was that machines can recognise e.g. chinese symbols. So why shouldn’t they recognise a way lower count of components?</p><p>This not only applies to Airbnb’s design system — it also applies to our internal design system. I decided to explore the concept a bit more in our 8th Hackweek. Can an AI help us turn wireframe sketches into coded web interfaces?</p><p>This article will dive into the technical aspects around the setup — the tools I used. What went well. Where I encountered problems. At the end, you should have a good idea about the whole process — and ideally you are able to set this up for yourself as well.</p><h3>The basic setup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ihTZnxB2iO0Uq2Ex8CefNg.png" /><figcaption>From webcam to node server to React frontend</figcaption></figure><p>The setup includes three separate steps:</p><ul><li>Get a machine learning instance up and running. It will be trained with sketches and will send its classifications to the node server.</li><li>A node server that listens to the incoming classifications and forwards them to the client.</li><li>A client app that receives the classifications and renders different components accordingly.</li></ul><h4>Machine learning instance</h4><p>After reading Airbnb’s blogpost, I did what every curious person would do: Check the author’s Twitter feed. I found out that Benjamin (and his team!?) used tooling from <a href="https://ml4a.github.io/">ml4a</a>:</p><blockquote>ml4a is a collection of free educational resources devoted to <a href="https://medium.com/@genekogan/machine-learning-for-artists-e93d20fdb097">machine learning for artists</a>.</blockquote><p>For this project, I used the <a href="http://ml4a.github.io/guides/DoodleClassifier/">DoodleClassifier</a>. It needs <a href="http://openframeworks.cc/">openFrameworks</a> to run/compile, so you need to download it as well. The openFrameworks website has <a href="http://openframeworks.cc/download/">some great setup guides</a> that you should follow.</p><p>Getting the ml4a Doodle Classifier to run was a bit more difficult. I never touched C++ code before, had no idea of XCode app compilation and the setup documentation left open quite some questions. I still managed to get it setup within one day. After that, I decided to write a “Getting started” guide for the project, you can find it in the <a href="https://github.com/ml4a/ml4a-ofx#getting-started">ml4a readme</a>. It’s just for Mac only right now since I have no experience with either Windows or Linux. If you do: Add the documentation!</p><p>Following the guide, you should be able to compile the DoodleClassifier app through XCode. I encountered <a href="https://github.com/ml4a/ml4a-ofx/issues/22">one problem with a relative path</a> but it was easy to solve it.</p><p>Per default, the generated app sends the classifications via Open Sound Control to localhost:5000. It sends only the label for each classification. Since I wanted to sort the classified items, I had to expand the data being sent out. Thanks <a href="https://medium.com/u/fd571979e3f6">Björn Brauer</a> for helping me with that. Here’s what I added:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/186b103abcf60dd356a758312577a968/href">https://medium.com/media/186b103abcf60dd356a758312577a968/href</a></iframe><p>The last part is the important bit. It adds the area, coordinates and dimensions of each classification to the message m.</p><p>I only rendered components into a mobile interface, so actually only the y value was useful for my case. The whole bunch of data will be useful for more complex cases. You could start placing components onto a grid. Or render responsive interfaces, providing different sketches.</p><p>Then the setup was ready for training with some samples of components I wanted to classify.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2aoL9V-aISQavKlzondQOw.jpeg" /><figcaption>A user info card, text, headlines and buttons were the four components I trained with</figcaption></figure><p>I trained the machine on the first day with sketches done by me and a colleague. We have very similar sketching styles. Then I wanted to open up the sample collection to more designers. Bad idea. Each one had some personality sprinkled into their sketches. This threw off the machine quite a lot. It would not be a problem with enough training data, though. But since I had limited time in the hackweek, I decided to only train the machine on my samples.</p><p>Apparently, the Airbnb team experienced the same issues:</p><h3>Benjamin Wilkins on Twitter</h3><p>@HerrBertling @jongold @genekogan This was our experience too. Didn&#39;t take much when we were only working from a one person drawing. Looking forward to seeing your results with multiple people drawing! 💪🏼</p><p>So either train the machine with one specific sketching style. Or prepare a <strong>lot</strong> of samples for good results.</p><h4>Node server</h4><p>Setting up a node server in itself is pretty easy. But I had no idea about Web Sockets or the Open Sound Control. So that was… fun 😉 I had to open two ports (OSC and Web Socket) depending on each other, piping the message through them. In the end, I arrived at a solution that was working but very unstable. Reloading within the client (hello, hot module replacement) made the OSC part try to open a port again which of course failed since the port was already in use. Which was okay for running the demo but would be quite annoying in any real life example. <a href="https://gist.github.com/HerrBertling/b2c213542e306187a38c2fd4f592ba7e">Here’s the index.js as a Gist</a>.</p><p>I’m pretty sure this can easily be enhanced and the crashing server can be circumvented. But hey, it’s a hackweek project so things should work somehow and not be perfect 😄</p><h4>Client side app</h4><p>The client part was pretty simple. I decided to go with <a href="https://github.com/Xing/hops/">Hops</a> as a starting point since that is the React setup we use within Xing. You can use whatever you want in here, e.g. <a href="https://github.com/facebookincubator/create-react-app">create-react-app</a> would also work fine. Or Vue. Or jQuery. Your setup just needs to handle Web Sockets in some way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_QsueK8_AUHd3Mc9Vp39MQ.png" /><figcaption>The setup with the node server and the client opened in the browser. You can see the error message on the right after reloading the page. Yeah. Annoying.</figcaption></figure><p>I opened the Web Socket connection on componentDidMount() and pushed the incoming messages into the app’s local state. In that step, I also sorted the messages by their y axis value to show them in the correct order.</p><p>Looping through the list, I returned different components depending on the classification.</p><p>You can set the classifier to “Run” and classify things whenever it detects a change. A simple movement of the table is enough to trigger a new classification, so that’s definitely not what you want to do. Or you throttle the input which I did not do. So I chose to only classify once.</p><p>Also, I did not implement any kind of purging for the state. Multiple classify actions would pile up within the state and show up beneath each other. Of course, sorting the components is then useless because the Y axis values are not be correct.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fi-QcNCiERCs%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Di-QcNCiERCs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fi-QcNCiERCs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/82f4c20c4925ce518763022f213ba4e7/href">https://medium.com/media/82f4c20c4925ce518763022f213ba4e7/href</a></iframe><p>And with these steps, your setup is done and working 🚀</p><h3>Conclusion</h3><p>Considering that I had pretty much no idea of how machine learning, C++ or even Web Sockets work, I’m surprised at how smooth the setup and data handling worked in the end.</p><p>This is of course a very rough prototype that could use a big deal of enhancement. From this point on, you’d of course need to do something with the result. Save the code somewhere. Connect logic/routing to e.g. the buttons. Explore creating responsive interfaces through interpreting the coordinates. Pipe this into Sketch as well. Or whatever else you come up with.</p><p>Seeing this result after only one week of work from a single person with some sprinkles of rubberduck help by others, I guess I have to say:</p><blockquote><a href="http://knowyourmeme.com/memes/i-for-one-welcome-our-new-insect-overlords#jeopardy">I, for one, welcome our new computer overlords.</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9333e125e61" width="1" height="1" alt=""><hr><p><a href="https://tech.new-work.se/teaching-a-machine-to-convert-wireframes-into-code-f9333e125e61">Teaching a machine to convert wireframes into code</a> was originally published in <a href="https://tech.new-work.se/">New Work Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From “Voice and Tone” Guidelines to UI Animations]]></title>
            <link>https://medium.com/jimdo-design/from-voice-and-tone-guidelines-to-ui-animations-b8fa9dad9108?source=rss-f7210e1c274------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8fa9dad9108</guid>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[ui]]></category>
            <dc:creator><![CDATA[Markus Siering]]></dc:creator>
            <pubDate>Fri, 07 Oct 2016 11:07:55 GMT</pubDate>
            <atom:updated>2016-10-07T14:21:21.054Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gmjN2a-K8hy_eIS7VDQkYw.jpeg" /><figcaption><a href="https://commons.wikimedia.org/wiki/File:Oscilloscope_Triangle_Wave.jpg">Oscilloscope Triangle Wave</a></figcaption></figure><p>In the <a href="http://us2.campaign-archive1.com/?u=6fbaddc8c1fce7588d1a35cb2&amp;id=be05e451bd&amp;e=e71860d911">one of the latest issues of the UI Animations Newsletter</a>, <a href="https://twitter.com/vlh">Val Head</a> proposed basing UI animations on the voice and tone guidelines your company uses for PR/Customer support etc.:</p><blockquote>Voice and tone documents can be a helpful source to inform how you design your UI animation. They’re especially helpful for getting past that “blank page syndrome” for animation ideas because they define a direction to aim for.</blockquote><p>So, I tried it a few weeks ago when I thought about how we could spruce up the animations within the Jimdo interface. Since I poured a <strong>lot</strong> of text into a GitHub issue about the whole topic, I figured I should publish these thoughts here for other people to get an idea of how this advice could work for them.</p><p>I used <a href="https://material.google.com/motion/material-motion.html">Material Design Motion</a> (MDM) as a base to build upon since it is a great tool and has very good ideas on how to animate a user interface. The majority of their content can be applied to many use cases, including the Jimdo one.</p><h3>Collecting from the voice and tone guidelines</h3><p>At Jimdo, we use a brand book which I browsed for adjectives and nouns that suggest how Jimdo brand should be presented. Of course, I found most of them in the “voice” part of the brand book:</p><ul><li>thrill</li><li>joyful</li><li>enthusiasm</li><li>delight</li><li>smooth</li><li>enjoyable</li><li>lighthearted</li><li>playful</li></ul><p>If I use these words and apply them to the interface, I would imagine the interface to have:</p><ul><li>Happy/enthused activation/hover states. Let the interface be “happy” about user interaction. (But in a cool way, of course.)</li><li>Have a playful, smooth, light(hearted) (dis-)appearance of elements</li><li>Be smooth when it comes to speed. We want to animate to help the user and make the experience of using our system better. The animations should not make the user wait. We do not want to show them fireworks and confetti each time they open the browser.</li></ul><p>This seemed to be a good foundation to check with teammates. I talked to people with different backgrounds (UX, product design, UI engineering, frontend developers,…). Literally everyone quickly replied: “But we don’t want to do too much and people should not wait!” — which was funny so I figured I’d need to…</p><h3>Think about speed</h3><p>An animation should not happen too fast to notice a difference between a direct change and the animation, since that would defeat the purpose of making it feel more natural and less technical. It should be “just right”. This leads to some basic guidelines:</p><ul><li>Elements entering the screen should ease into the final position, slowing down when going there.</li><li>Elements leaving the screen should leave quickly since they are not needed anymore.</li><li>Elements moving on screen take time relative to the distance they travel. Normally, elements do not travel too far within the system, so you barely have a very long transition.</li></ul><p>Since most of our users currently work on desktop computers, elements can move fast. MDM has a good point here:</p><blockquote><em>Desktop animations should be faster and simpler than their mobile counterparts. These animations should last 150ms to 200ms.</em></blockquote><blockquote><em>Because desktop transitions may be less noticeable, they should be immediately responsive and faster than their mobile counterparts.</em></blockquote><blockquote><em>Complex web transitions often result in dropped frames (unless they are built for GPU acceleration). Shorter durations will make these less noticeable because the animation completes faster.</em></blockquote><p>That’s how I arrived at these possible speeds for different animations:</p><pre>$veryfast: 100ms;<br>$fast: 150ms;<br>$medium: 250ms;<br>$slow: 350ms;<br>$veryslow: 500ms;</pre><h3>Animating elements</h3><p>As said above, depending on what happens to an element, we should use different animations for different cases. Therefore, I derived some easing curves from <a href="https://material.google.com/motion/duration-easing.html#duration-easing-natural-easing-curves">the ones MDM suggests</a>.</p><p>The curves used within MDM feel very straightforward and technical. So based on the adjectives I derived, I decided to make them a bit more playful while keeping the <a href="https://media.giphy.com/media/lPsMh9VaCn5QI/giphy.gif">general idea</a> of accelerating quickly and decelerating more slowly. The main difference: Our animations reach a bit over the top before stopping. For the standard curve, this is barely noticeable, which actually is fine. People shouldn’t really notice the animation and rather get the correct impression through the interaction without actively thinking about it.</p><p><strong>The standard curve</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/1*5AxpeHwnv_DaKIAYNf9zlQ.gif" /><figcaption>Animated radio buttons with the standard animation curve</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/1*p0VhW4cT_ywZRERBNeiL5A.gif" /><figcaption>Animated radio buttons at 25% of the actual speed</figcaption></figure><pre>cubic-bezier(0.4, 0.0, 0.2, 1.4);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*eqNSMaHdbexc5Ji7id7nFg.png" /><figcaption>The actual curve for the standard cubic-bezier curve described above</figcaption></figure><p><strong>Enter screen curve</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*EICTIIYHigb1axpH6Igncw.gif" /><figcaption>Modal opening with 25% of the speed to show the animation in a more finegrained way</figcaption></figure><pre>cubic-bezier(0.0, 0.0, 0.2, 1.4);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*5DAOkUhd0aK4ayE82Hd18g.png" /><figcaption>The actual curve for the enter screen cubic-bezier curve described above</figcaption></figure><p><strong>Exit screen curve</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*1oebVoB3Qfl3VahyvvhWvw.gif" /><figcaption>Modal closing on 25% of the normal speed to show animation details</figcaption></figure><pre>cubic-bezier(0.4, -0.4, 0.6, 1.4);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*zUlxCuqvRC0VmOqC0wAWMw.png" /><figcaption>The actual curve for the exit screen cubic-bezier curve described above</figcaption></figure><p>The good thing about these curves is: you don’t have to care about the overreach when implementing anything. The curve will take care of e.g. growing the animated item beyond the final state and back. This makes using the animations way easier and is a nice bonus for everyone not that involved with how the animation should work — they can simply “plug&amp;play” the animations.</p><p>These ideas are currently not represented within our system but we’re getting there. One thing we already noticed is that it is very difficult to put these animation curves into mixins that can be thrown into the CSS code immediately.</p><p>We use a pattern library. In it, a lot of animations can be generalized and used in a consistent way. If larger parts of the system need animation, these should rather be handcrafted instead of using a one-size-fits-all approach through mixins. While this will take more effort to accomplish, it will result in better animations throughout the system.</p><p>The basics are given through these animation curves–thanks to the voice and tone guidelines 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8fa9dad9108" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jimdo-design/from-voice-and-tone-guidelines-to-ui-animations-b8fa9dad9108">From “Voice and Tone” Guidelines to UI Animations</a> was originally published in <a href="https://medium.com/jimdo-design">Jimdo Design</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I learned in five weeks of using CSS Modules]]></title>
            <link>https://medium.com/@herrbertling/what-i-learned-in-five-weeks-of-using-css-modules-4920d9eccf80?source=rss-f7210e1c274------2</link>
            <guid isPermaLink="false">https://medium.com/p/4920d9eccf80</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[css-modules]]></category>
            <dc:creator><![CDATA[Markus Siering]]></dc:creator>
            <pubDate>Sun, 13 Mar 2016 14:01:50 GMT</pubDate>
            <atom:updated>2016-03-13T14:01:50.163Z</atom:updated>
            <content:encoded><![CDATA[<p>Five weeks ago, I posted a <a href="https://medium.com/front-end-developers/today-i-had-the-first-opportunity-to-use-css-modules-in-a-work-project-17ac0ef5d584#.63q2xm4xl">short braindump</a> about my first experience with CSS Modules. It generated way more feedback than I expected, so I thought you might be interested in my learnings after one month. Here we go!</p><h4>Better dev setup</h4><p>It was just a tiny thing in the end, but very helpful: We adjusted the class names for our dev environment. So instead of completely obfuscated classes, we now get a nice structure while developing things — just by a short line within the webpack configuration added to the CSS loader:</p><pre>&amp;localIdentName=[name]__[local]__[hash:base64:5]</pre><p>This gives you a nice class name like “sidebar__navigation__2jdi4”. Makes checking the code and finding problems so much faster for everyone. Another benefit is that everyone who just looks at the code within the browser’s inspector can directly <strong>talk </strong>about the correct component. Faciliates working with the code a lot.</p><h4>Getting familiar with how JSX works</h4><p>Over the last weeks, thanks to some pairing sessions with the frontend devs within our team, I got confident enough to work within the JSX files and add classes I need in there. If it’s not too complicated, I can put in the variables and information I need (like “is the sidebar currently open”) to adjust classes in the correct way. Really cool.</p><p>Also, we derived patterns from the stuff we use in the interface to re-use them. The way logic is handled within JSX is great. It makes it way easier for everyone involved to derive the logic within a pattern and re-use it quickly. Well, that’s probably not a CSS Modules win, but rather a React thing, though. Still helpful.</p><h4>Composing</h4><p>I wondered about repetitive code after my first encounter with CSS Modules. Since that really seemed like a huge problem as soon as a project starts growing, we tried to solve it as soon as possible.</p><p>This turned out to be a minor problem first — thanks to not reading the documentation well enough to get the nitty-gritty stuff. Turning to Twitter and asking helped resolving this quickly:</p><h3>Mark Dalgleish on Twitter</h3><p>@herrbertling are you providing the `importLoaders` option to css-loader? https://github.com/webpack/css-loader#importing-and-chained-loaders ...</p><p>From that point on, I used the composing pretty often. It’s so simple and a great way to keep styles across different components/items the same.</p><p>If you are used to Sass and it’s @extend syntax, you should note the difference between composing and extending classes. Glen Madden has this covered in his great article “<a href="http://glenmaddern.com/articles/css-modules">CSS Modules — welcome to the future</a>”. Basically, composing slaps more classes onto your HTML instead of grouping classes within the CSS.</p><h4>Self-contained files</h4><p>This is probably a normal thing for frontend devs who deal with JS all the time. I don’t, so this was new. When writing Sass code that would be compiled by some Gulp or Grunt or $whatever task, I often just imported the different component files into a bigger group (e.g. _sidebar-navigation.sass, _sidebar-footer.sass,… into sidebar.sass). That bigger group file would also contain something like _sidebar-variables.sass. Keeping all variables there was a good and nice thing to do. But I never required the variables file within the smaller files. I just knew implicitly that this file would be imported somewhere up the dependency tree.</p><p><em>Wow, I use smart words like “dependency tree” now!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*CAv4gK4pbcMRKI4WP-kpMQ.gif" /></figure><p>With React and the CSS Modules, I know have to require everything that is needed within a file explicitly within that file. This seemed unnecessary and tedious to me at first. Now it just makes so much sense: Everyone gets what is needed in each file directly from looking at it. There is no more implicit knowledge hidden somewhere within the different files. It saves time for anyone coming into the project because there’s just no need to search for dependencies anymore. That is really good. And got me to write more thorough code as well.</p><h4>Tooling</h4><p>That’s probably the biggest downside after all. And also not directly related to CSS Modules, but rather the “modern” web dev stack. By now I totally get the <a href="https://medium.com/@ericclemmons/javascript-fatigue-48d4011b6fc4#.4dceba3xb">Javascript Fatigue</a> post:</p><ul><li>Wrong node version since you switched back and forth between projects? Bummer, here’s a big unreadable cryptic error message!</li><li>Add the standard autoprefixer to your setup? Not for you, Sir! We as a project rather decide to forget how we resolved imports before, sorry. This cost us about three hours of intense Staring At Code™ with JS/CSS/Sass people without understanding or solving the problem.</li><li>Installed a new npm package? That’s unfortunate, we don’t like your Sass compiler anymore.</li></ul><p>Some of this could probably be resolved by switching to PostCSS instead of using Sass. But in the end, I want to write some flavor CSS and produce code. I’m not there for debugging the endless chain of node modules that comes with all of the modern shenanigans.</p><h4>Links</h4><p><a href="https://medium.com/u/ab030b169c99">David Hellmann</a> asked for some links around this topic that were helpful. Acutally, there are not <em>that</em> many articles on the topic that expanded the ideas that are laid out in the probably most “famous” contributions to the topic, so I’d say you’ll be off to a good start with:</p><ul><li><a href="https://medium.com/seek-ui-engineering/the-end-of-global-css-90d2a4a06284#.wxad86dga">The End of Global CSS</a> by <a href="https://medium.com/u/d7225e72eea">Mark Dalgleish</a></li><li><a href="http://glenmaddern.com/articles/css-modules">CSS Modules — welcome to the future</a> by <a href="https://medium.com/u/59124a41bb46">Glen Maddern</a></li><li>Docs for <a href="https://github.com/css-modules/css-modules">CSS Modules</a> and the <a href="https://github.com/webpack/css-loader">webpack CSS loader</a></li><li>A savvy JS frontend dev who knows a bit about webpack/React to get you started</li></ul><h4>So, what do you think about CSS Modules?</h4><p>CSS Modules are great. You should use them. You’ll learn a lot. In parts, you will be forced to write better code. Maybe you’ll think about ditching Sass altogether in favor of PostCSS (I do!). Oh, and you should pray for your tooling to work ;-)</p><p>Have fun!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4920d9eccf80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Modules — first impression]]></title>
            <link>https://medium.com/@herrbertling/today-i-had-the-first-opportunity-to-use-css-modules-in-a-work-project-17ac0ef5d584?source=rss-f7210e1c274------2</link>
            <guid isPermaLink="false">https://medium.com/p/17ac0ef5d584</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Markus Siering]]></dc:creator>
            <pubDate>Mon, 08 Feb 2016 18:57:32 GMT</pubDate>
            <atom:updated>2016-02-15T16:44:41.233Z</atom:updated>
            <content:encoded><![CDATA[<p>Today I had the first opportunity to use CSS modules in a work project. I thought it would be a good idea to write down my first, fresh impressions on them, if only to see how this will evolve within the next days.</p><h3>The cool stuff</h3><h4><strong>Local by default</strong></h4><p>Being local by default is pretty neat. You don’t need to worry about naming classes in a global context. You don’t need to care about overwriting styles that might be used somewhere else in your project. Cool!</p><h4>className syntax</h4><p>The className syntax is easy to work with. I’m not writing JS normally – fiddling with jQuery to get what I want in smaller demos is what I was used to until now. Despite this rather narrow JS knowledge, I was able to add a new component and use the className syntax real quick just by looking at what the others did in the project before. Neat.</p><h4>Obfuscated classes</h4><p>The automated class naming is great! You don’t have to think about any BEM like syntax, re-using of class names (Hi, .wrapper) or need to juggle with way too long but explicit class names. Having small components with only a few items to style takes all of this away in an instant. Instead, just use a short, obvious name for the item, chain it with your context’s overall name and you’re golden. No need to look at the actual classes at all in the end – nice.</p><h3>The bad (?) stuff</h3><h4>Loosing the global scope</h4><p>Maybe I’m missing something here. But if you are used to working with a global context, it’s strange to suddenly loose it. Having a body class toggle that would alter the behaviour of different parts of your app? No idea how to do this. Having a global context made this easy to achieve.</p><p>I had no time to look into it, but this indeed was a problem for me. It will most certainly be solved tomorrow when sitting down with a colleague. Still it’s strange to not be directly able to just do this just like I was used to.</p><h4>Tight coupling of JS and Sass</h4><p>I’m not sure if I even want a dedicated Sass folder anymore. The components are coupled so tight right now, it would almost make more sense to put the corresponding Sass files right next to each component’s JS file. Maybe. Maybe not. We’ll see.</p><h4>Don’t repeat yourself?</h4><p>I’m not quite sure if the local scope will lead to duplicated styles at some point? Then again, I’m pretty sure that someone will have thought about this already. So I’ll hopefully just have to check on this and be done with the worries.</p><h4>Obfuscated classes</h4><p>Yes, this point appears twice on this list. I’m pretty sure there are solutions for debugging the obfuscated classes (probably sourcemaps we don’t currently use in the project!?). Right now, I need to know which part/component of the project I’m looking at in the browser to adjust it within my source. Not cool when a project grows. As said, there’s certainly a solution out there already which I just didn’t search for yet.</p><p><strong>TL;DR</strong>: I like it and I have hopefully just scratched the surface.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17ac0ef5d584" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>