<?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[Highsnobiety Tech - Medium]]></title>
        <description><![CDATA[Technology is our core - Medium]]></description>
        <link>https://medium.com/highsnobiety-tech?source=rss----20c2cf5b8f4d---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Highsnobiety Tech - Medium</title>
            <link>https://medium.com/highsnobiety-tech?source=rss----20c2cf5b8f4d---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 09:08:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/highsnobiety-tech" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Optimizing our deployment pipeline]]></title>
            <link>https://medium.com/highsnobiety-tech/optimizing-our-deployment-pipeline-part-1-3fb04e727013?source=rss----20c2cf5b8f4d---4</link>
            <guid isPermaLink="false">https://medium.com/p/3fb04e727013</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[deployment-pipelines]]></category>
            <dc:creator><![CDATA[Michael Duve]]></dc:creator>
            <pubDate>Fri, 13 Jul 2018 10:07:03 GMT</pubDate>
            <atom:updated>2018-07-15T13:47:02.018Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RYyVRQLqvwQTPFgIv2IpDg.jpeg" /></figure><h3><strong>Optimizing our deployment pipeline — Part 1</strong></h3><h4>Minimizing feedback loops and bottlenecks</h4><p>When I started working for Highsnobiety five months ago, I was asked to look into our deployment and quality assurance (QA) process, because we only had one QA environment where we merged all our features to review them before going live. This often led to unforeseen behaviour in some test cases. But let me start from the very beginning.</p><p>Today’s article is the first in a short series of articles. As soon as each one is published you’ll be able to find all articles in this series linked here:</p><ul><li>Part 1: <a href="https://tech.highsnobiety.com/optimizing-our-deployment-pipeline-part-1-3fb04e727013">Minimizing feedback loops and bottlenecks</a></li><li>Part 2: <em>Upcoming…</em></li><li>Part 3: <em>Upcoming…</em></li></ul><p>We are working in bi-weekly sprint cycles applying a loosely adapted Scrum methodology. Our legacy codebase has a weekly deployment rhythm, while our other services can be deployed continuously. In each sprint planning, we have a rotating deployment responsibility for two people — our “deploy peers”. They manage the whole process from publishing the code over to monitoring the site and system afterwards. Code that is being deployed has passed the quality criteria which is defined in our Definition of Done (DoD), that includes the following rules:</p><ul><li>Unit and Integration tests running above 80% (we’re still very tolerant)</li><li>The code is reviewed and approved by a peer</li><li>All changes are tested on relevant browsers</li></ul><h3>Workflow challenges</h3><p>The development of a new feature is usually sparked by a stakeholder’s idea. Once the Product Owner has accepted the idea, the user story will be put in a ticket in the backlog and eventually included in the upcoming sprint. As probably every front-end developer knows things are often not as easy as they seem. In our case, we have two separate feedback loops: DoD and QA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*S_oX7qMOTNSamG1nhRGEsw.jpeg" /><figcaption>Figure 1: A pretty standard development process</figcaption></figure><p>Everything we develop is measured against the user story and its acceptance criteria. As of now, we process DoD and QA sequentially, because we do not want our unreviewed and untested code to be merged. This sequential processing prevents us from picking up speed. Let’s think further: What happens if all developers are either sick or busy? Let’s think one step further: What would happen if all developers were either busy or on sick leave? QA would then have to wait for a developers’ merge, which would present us with our first bottleneck. Alternatively, if we didn’t have to merge our code, we could do a code review AND have the reviewers take a look.</p><blockquote><em>Challenge #1: Code-Review is blocking review process</em></blockquote><p>One of our main challenges is that non-developers cannot run the new features on their own machines. At many companies, you have <strong>one</strong> QA environment where you can deploy specific tickets that need to be reviewed by non-developers. But wait: If we have one environment to rule them all, what happens to changes colliding with each other? For instance, if you have deployed a bugfix for the main navigation, but another feature has been deployed on QA afterwards, which also affects the main navigation. Your bugfix needs to go live ASAP and you already told the stakeholder that they can have a look on QA. Bummer, your changes are gone and you need to re-merge your code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*P2lCO4Ml8xV6EuzCB7NEHQ.png" /><figcaption>Figure 2: What our review process looks like</figcaption></figure><blockquote><em>Challenge #2: One environment for reviewing different features</em></blockquote><p>Additionally, we do not keep track of deployed features on QA, which can lead to unexpected behaviour. CSS from feature A can positively affect feature B on QA. When deploying tested feature B on production, it might break due to feature A not being deployed, yet.</p><p>You still need to pass reviews by design, product, and the stakeholder. They represent our end user and the business side. Usually, there are some proposed amendments by at least one party. I won’t list all the details about how those changes will be applied, but you can probably imagine how time consuming this process is.</p><p>Everybody has their own daily work so it might take a while before people can review the story we’re working on. Our Product Owners, for example, are juggling many projects at once and attend regular meetings with various stakeholders. Therefore, it’s possible you could have to wait up to several days before receiving feedback. Having only one QA environment can mean, that changes we merged a few hours or days ago, may be gone when the reviewer looks for them.</p><blockquote><em>Challenge #3: Lack of knowledge about features merged onto QA</em></blockquote><p>An additional point to highlight is that I would like to focus on my work instead of reminding people to review my feature. At the moment, I have to speak to each part of the QA process and tell them that a new feature has been merged onto QA and can be reviewed. The process of initiating a review should work automatically.</p><blockquote><em>Challenge #4: Asynchronous and manual communication between reviewers and developer</em></blockquote><p>Every modification proposal we receive restarts the development loop from the beginning, going all the way back to the developer’s IDE and passing DoD again.</p><p><strong>TL;DR:</strong></p><ul><li>Code-Review is blocking the review process</li><li>One environment for reviewing different features</li><li>Lack of knowledge about features merged onto QA</li><li>Asynchronous and manual communication between reviewers and developer</li></ul><p>The natural question that follows is: Why don’t we automate parts of this process? Why don’t we have an easier way of getting things done? We could, probably.</p><h3>Our Solution</h3><p>Let’s find a solution to the problems at hand, starting with our first problem: Having only one environment for testing.</p><p>After development is done, a process should be in place, which deploys the current state of the application on an independent server that is accessible by the reviewers. We call it Preview Service. Every time a pull request is created or updated (development iteration is done), a link is automatically posted in the corresponding ticket. Everyone following this ticket (stakeholder, product, design) will be notified about this update.</p><blockquote>https://xyz.highsnobiety.com/{namespace}/{repository}/{container-tag}</blockquote><p>Access is granted upon entering credentials, so no outsider can sneak a peek at our upcoming features. By visiting a preview link for the first time, the Preview Service launches an instance based on the Docker image of the current branch. This can take up to a few minutes, depending on the container boot up time. While booting, the user receives real-time feedback on the service’s status.</p><p>Once the temporary preview environment is up and running, the loading page redirects the user to the service’s entry point. For every version, the current revision is removed and another instance is launched. Having the Preview Service in place will solve our problem of code review blocking progress on QA. In addition, no more communication is needed, because every party is notified automatically. This is also beneficial for the QA of more advanced features, which are executed by an external team through crowdsourcing. They need up to three days to test a new version of our software. At the moment this freezes the environment completely, blocking it for other QA purposes. In the future this would no longer be an issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*-Ayd465FRd3Ze9Vroo6R5A.png" /><figcaption>Figure 3: What it should look like after implementing Preview Service</figcaption></figure><p><strong>TL;DR: </strong>We will create a service which creates a temporary isolated environment just displaying one feature at a time. Communication will be inside the ticket, where the links to the Preview Services are automatically posted. This will increase the number of deployments since features can be tested in isolation. Its goal is to also raise developers’ motivation because those feedback loops feel less time consuming.</p><h3>What’s next?</h3><p>In part two of this series, we will dive deeper into the actual implementation of our solution with Docker, Kubernetes, and Elixir. Our main focus will be on web services because they have one communication protocol (HTTP) in common.</p><p><em>Make sure to subscribe to </em><a href="https://tech.highsnobiety.com/"><em>Highsnobiety Tech</em></a><em> to not miss upcoming parts of this series!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fb04e727013" width="1" height="1" alt=""><hr><p><a href="https://medium.com/highsnobiety-tech/optimizing-our-deployment-pipeline-part-1-3fb04e727013">Optimizing our deployment pipeline</a> was originally published in <a href="https://medium.com/highsnobiety-tech">Highsnobiety Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t let CSS slow down your React-App!]]></title>
            <link>https://medium.com/highsnobiety-tech/dont-let-css-slow-down-your-react-app-d7a1e7d4a614?source=rss----20c2cf5b8f4d---4</link>
            <guid isPermaLink="false">https://medium.com/p/d7a1e7d4a614</guid>
            <category><![CDATA[universal]]></category>
            <category><![CDATA[ssrs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[isomorphic]]></category>
            <category><![CDATA[css-modules]]></category>
            <dc:creator><![CDATA[Daniel Schäfer]]></dc:creator>
            <pubDate>Wed, 13 Dec 2017 09:59:35 GMT</pubDate>
            <atom:updated>2018-01-04T15:51:44.431Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to avoid render-blocking CSS when doing SSR with ReactJS</h4><p>If you’re a frontend developer and have ever used services such as <a href="https://speedcurve.com/">SpeedCurve</a> or <a href="https://developers.google.com/speed/pagespeed/">Google PageSpeed</a>, then you may have had one of those tools already complaining about your website containing “render-blocking CSS”.</p><p>This blog post is explains what render-blocking CSS means and how to avoid it in your ReactJS app.</p><h4>What is render-blocking CSS?</h4><p>Having render-blocking CSS means, that you are referencing an external CSS resource with a regular &lt;link&gt; tag.</p><p><strong>Why is that render-blocking?</strong></p><p>While a web browser can render any arriving chunk of HTML instantly without having to receive the whole document first <em>(which is why server-side HTML streaming is another cool way to speed up your render-performance)</em>, it will, however, pause at any synchronously referenced resource (such as CSS or JS) until it has completely downloaded it.</p><p>That’s precisely why it’s a good idea to put references to Javascript files at the end of the DOM tree. Because in that case, the browser will already have been able to render the complete body of the page before finally taking care of loading and executing the Javascript file.</p><p>Unfortunately, you can’t apply the same easy fix to CSS, since CSS links must live in the head section of the DOM tree. And since the head section comes before the body of the document, the browser won’t be able to render anything without having loaded the referenced CSS first.</p><p>And this means that your website visitor will have to wait for another network round trip to finish before the blank browser page can start filling up with content.</p><p>That’s why it’s called “render-blocking”.</p><h3>How to prevent render-blocking CSS?</h3><p>An easy fix to eliminate the extra network request for loading referenced CSS resources would be, to directly inline the CSS, using the &lt;style&gt; tag instead of referencing it with a &lt;link&gt; tag.</p><p>If you’re using Webpack, then you probably already stumbled over the <a href="https://github.com/webpack-contrib/style-loader">style-loader</a>. It does precisely that: Inlining <strong>all</strong> imported styles of your app into the head section of the document.</p><p>However, what we preferably want, is only to ship that part of the app’s CSS that’s relevant for rendering the current page, the so-called “Critical CSS”.</p><p>So, while the style loader is a step in the right direction as it avoids making an extra network request, it sadly still doesn’t offer a satisfying solution, as it pollutes the HTML document with CSS not required for rendering the current page, thereby unnecessarily increasing the page load time.</p><h3>Shipping only the “Critical CSS”</h3><h3>The traditional way</h3><p>For traditional websites, <a href="https://github.com/addyosmani/critical-path-css-tools">some people solved this problem</a> by using a headless browser on the server, which pre-renders the requested page and then figures out what part of the complete set of CSS rules is required to render the requested page. It then only inlines this subset into the HTML document that is then shipped to the browser.<br>But this approach comes with its own issues and also adds complexity to the production stack.</p><h3>The ReactJS way</h3><p>The guys from Kriasoft created the excellent <a href="https://github.com/kriasoft/isomorphic-style-loader/">isomorphic-style-loader</a>, which is a drop-in replacement for the classic style-loader.</p><p>Instead of inlining all styles, it will only inline the critical CSS, which is precisely what we want!</p><p><strong>Let’s see you how this is works:</strong></p><p>The loader, of course, needs to know somehow, what part of the CSS is required to render the requested page. It can achieve that, by us telling it, what styles every single component needs. The loader can then do the math by quickly checking, what components are used to construct the current page.</p><p>We’re using the withStyles helper provided by the isomorphic-style-loader to achieve that:</p><pre><em>// MyComponent.js</em></pre><pre>import React from &#39;react&#39;;<br><strong>import withStyles from &#39;isomorphic-style-loader/lib/withStyles&#39;;</strong><br>import styles from &#39;./MyComponent.scss&#39;;</pre><pre>function MyComponent(props, context) {<br>  return (<br>      &lt;div className={styles.title}&gt;<br>        Hello world!<br>      &lt;/div&gt;<br>  );<br>}</pre><pre>export default <strong>withStyles(styles)(</strong>MyComponent<strong>)</strong>;</pre><p>Or, if you’re using recompose (which I highly recommend) add withSyles to your enhancers:</p><pre>const enhance = compose(<br>  <strong>withStyles(styles)</strong>,<br>  // ...your other enhancers<br>);</pre><pre>export default enhance(MyComponent);</pre><p>The isomorphic-style-loader will now ensure, that at any time all critical CSS is inlined in the &lt;head&gt; section of the HTML. That means, when changing the route, it automatically manipulates the DOM to remove CSS rules that are not required on the next page and inserts new rules instead. Awesome!</p><h4>Server-side rendering</h4><p>When doing server side rendering (SSR) with React though, we have to do a bit of extra work, as there is no real DOM that could be manipulated by the isomorphic-style-loader.</p><p>But no worries, it’s just a few lines of code that we need to add to make this work on the server side.</p><p>Here’s a stripped down version of the server.js, which is responsible to construct the initial DOM on the server:</p><pre><em>// server.js</em></pre><pre>import express from &#39;express&#39;;<br>import ReactDOM from &#39;react-dom&#39;;<br>import router from &#39;./router.js&#39;;<br><br>const server = express();<br><br><em>// Server-side rendering of the React app</em><br>server.get(&#39;*&#39;, (req, res, next) =&gt; {<br>  <strong>const css = new Set();</strong><br>  <strong>const context = {<br>    insertCss: (...styles) =&gt;<br>      styles.forEach(style =&gt; css.add(style._getCss()))<br>  };</strong><br>  router.dispatch({ ...req, <strong>context</strong> }).then((component, state) =&gt; {<br>    const body = ReactDOM.renderToString(component);<br>    const html = `&lt;!doctype html&gt;<br>      &lt;html&gt;<br>        &lt;head&gt;<br>          &lt;script async src=&quot;/client.js&quot;&gt;&lt;/script&gt;<br>          <strong>&lt;style type=&quot;text/css&quot;&gt;${[...css].join(&#39;&#39;)}&lt;/style&gt;</strong><br>        &lt;/head&gt;<br>        &lt;body&gt;<br>          &lt;div id=&quot;root&quot;&gt;${body}&lt;/div&gt;<br>        &lt;/body&gt;<br>      &lt;/html&gt;`;<br>    res.status(state.statusCode).send(html);<br>  }).catch(next);<br>});</pre><p><em>(Note, that this example uses React-Router 2. You can find a SSR example using the newest React-Router version </em><a href="https://github.com/kriasoft/react-starter-kit/blob/master/src/server.js"><strong><em>here</em></strong></a><em>.)</em></p><p>All we had to do here, is to overwrite the insertCss method in the context object, that’s provided by the withStyles enhancer.</p><p>In the browser, the insertCSS method would manipulate the DOM tree by adding the CSS rules into the head.</p><p>The new SSR implementation of the insertCss method instead takes the styles and stores them in a map and eventually dumps all collected styles as a string into the HTML code.</p><p><strong>And that’s it!</strong></p><p>The server-side rendered page will now:</p><ul><li><strong>Have only the Critical CSS inlined </strong>✅</li><li><strong>Will not include any render-blocking CSS via </strong><strong>&lt;link&gt; reference</strong> ✅</li></ul><h3>Pro Tip: CSS Modules</h3><p>Noticed, how we used title as a class name to style a div in the component in the example above?</p><p>&lt;div className={styles.title}&gt;</p><p>Usually, you would use something more unique as a class name, such as my-component-title to make sure your class names do not conflict with those of other components:</p><p>&lt;div className={styles[&#39;my-component-title&#39;]}&gt;</p><p>But fortunately, the <a href="https://github.com/webpack-contrib/css-loader">css-loader</a> can take care of namespacing your CSS rules for you by just adding a small config option. That way title would automatically be converted to something like t9e9d_MyComponent_title behind the scenes, making sure, it is unique across all components, while you can still refer to it as styles.title in your code.</p><p>To use this cool feature called “CSS-Modules”, all you have to do is add two lines to your css-loader config section:</p><pre>module: {<br>  rules: [<br>    {<br>      test: /\.css$/,<br>      use: [<br>        &#39;isomorphic-style-loader&#39;,<br>        {<br>          loader: &#39;css-loader&#39;,<br>          options: {<br>            <strong>modules: true,<br>            localIdentName: &#39;[hash:base64:5]_[name]_[local]&#39;</strong><br>          }<br>        }<br>      ]<br>    }<br>  ]<br>}</pre><p>You can play around with the localIdentName option. If you prefer it less verbose in (for example for your production setup), a simple[hash:base64:8] producing something like t9e9d48a will work equally well.</p><p><strong>Have fun!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7a1e7d4a614" width="1" height="1" alt=""><hr><p><a href="https://medium.com/highsnobiety-tech/dont-let-css-slow-down-your-react-app-d7a1e7d4a614">Don’t let CSS slow down your React-App!</a> was originally published in <a href="https://medium.com/highsnobiety-tech">Highsnobiety Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>