<?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 Fabian de Rijk on Medium]]></title>
        <description><![CDATA[Stories by Fabian de Rijk on Medium]]></description>
        <link>https://medium.com/@fabianderijk?source=rss-1882bd83ef29------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*X4FqPpDH-hHIfkpX.jpg</url>
            <title>Stories by Fabian de Rijk on Medium</title>
            <link>https://medium.com/@fabianderijk?source=rss-1882bd83ef29------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 08:38:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fabianderijk/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[Load translations from custom Drupal 8 modules]]></title>
            <link>https://medium.com/@fabianderijk/load-translations-from-custom-drupal-8-modules-32c5f1037cdb?source=rss-1882bd83ef29------2</link>
            <guid isPermaLink="false">https://medium.com/p/32c5f1037cdb</guid>
            <category><![CDATA[localization]]></category>
            <category><![CDATA[drupal]]></category>
            <dc:creator><![CDATA[Fabian de Rijk]]></dc:creator>
            <pubDate>Fri, 06 Mar 2020 07:06:04 GMT</pubDate>
            <atom:updated>2020-03-06T07:06:04.179Z</atom:updated>
            <content:encoded><![CDATA[<p>Whenever you have built a Drupal 8 module for a non-English site you will have had this issue. You have strings that are English in code using the t() function, but you want to have them translated during your release. How does this work? I&#39;ll show you!</p><h3>The requirements</h3><p>First of all we need a module to extract the English strings from our custom module. You can use <a href="https://www.drupal.org/project/potx">Translation template extractor</a> for that.</p><p>First download the module: composer require drupal/potx</p><p>The enable it: drush pm:enable potx</p><p>Now you have the module installed. From now on you can use the module via the interface on admin/config/regional/translate/extract. Just select your module, the template file for the language you want to export for and hit extract.</p><h3>What to do with the extracted file?</h3><p>The extracted file can be placed in a subfolder of your module (for example ‘translations’) and can be edited with every basic text editor or IDE.</p><p>A example of a translation can be:</p><pre>msgid &quot;The description of my module.&quot;<br>msgstr &quot;De beschrijving van mijn module.&quot;</pre><p>The msgid is the string to translate and the msgstr is the translated string. In this example from English to Dutch.</p><p>Once you have translated all your string you need to make your module aware of the translations. You can do this by adding some lines to you module_name.info.yml file.</p><pre>name: &#39;My module name&#39;<br>type: module<br>description: &#39;My module description&#39;<br>core: 8.x</pre><pre>interface translation project: my_module<br>interface translation server pattern: &#39;modules/custom/my_module/translations/my_module.%language.po&#39;</pre><p>The last two lines in this example show you how you can make your module aware. Notice the %language variable? This makes sure that you can use separate translation files for each language. Just make sure you add the language code to the filename, for instance &#39;nl&#39; for Dutch or &#39;se&#39; for Spanish.</p><h3>Importing the translations</h3><p>Importing the translations is as easy as running two drush commands that (as far as I’m concerned) you should run on every release.</p><p>First: drush locale-check</p><p>This command checks for available translation updates for your installed modules. Both custom and contributed modules and themes and checks (when default settings are applied) on both the Drupal localization server and the local filesystem.</p><p>Next: drush locale-update</p><p>This command actually updates the translations. This only updates new or non-translated strings so you don’t need to worry about losing your handmade translations.</p><p><em>This post was initially publish on July 17, 2019</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32c5f1037cdb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decoupled Drupal — The holy grail! Or not!]]></title>
            <link>https://medium.com/@fabianderijk/decoupled-drupal-the-holy-grail-or-not-65af7d33d990?source=rss-1882bd83ef29------2</link>
            <guid isPermaLink="false">https://medium.com/p/65af7d33d990</guid>
            <category><![CDATA[decoupled]]></category>
            <category><![CDATA[drupal-8]]></category>
            <category><![CDATA[strategy]]></category>
            <category><![CDATA[headless]]></category>
            <dc:creator><![CDATA[Fabian de Rijk]]></dc:creator>
            <pubDate>Fri, 06 Mar 2020 07:02:53 GMT</pubDate>
            <atom:updated>2020-03-06T07:02:53.860Z</atom:updated>
            <content:encoded><![CDATA[<h3>Decoupled Drupal — The holy grail! Or not!</h3><p>Agreed, decoupled Drupal is awesome. It gives great opportunities to build omnichannel, inviting, flexible and interactive applications which are totally 2019! To be honest, it is great that Drupal finally took the leap with creating a API first CMS and adding JSON:API to core. However, in my journey on creating rich internet platforms, websites and applications based on Drupal, I found out that decoupled Drupal is not (always) the holy grail. In fact, it can really turn out into a maintenance nightmare.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gFrYK6f-d6t6YWyZs4dnOQ.jpeg" /></figure><h3>What is decoupled Drupal?</h3><p>For a lot of people among us, decoupled Drupal, or headless Drupal, is a known term, but let me explain it for the lesser introduced reader.</p><p>According to Acquia decoupled Drupal can be explained as:</p><blockquote>Decoupled Drupal (or headless Drupal) allows the developer to utilize any technology to render the front-end experience in lieu of the theming and presentation layers in Drupal. This process utilizes Drupal as a content service. The Drupal back end exposes content to other systems, such as native applications, JavaScript applications, and IoT devices.”</blockquote><p>This just means that, while using Drupal as a content management system (CMS), you can use a frontend framework like<a href="http://reactjs.org/"> React</a>,<a href="https://vuejs.org/"> Vue</a> or<a href="https://angular.io/"> Angular</a> to create the frontend and get all data from Drupal using webservices, GraphQL, etc.</p><p>In this article I won’t give you my opinion, I’ll keep that to myself for now. I will however give you pointers you need to help you decide if a decoupled website is something you need for a project, or in general.</p><h3>Decoupled strategies</h3><p>When you are thinking about doing a project (progressively) decoupled you need to know a few things in advance. Like, what kinds of (de)coupled are there?</p><h3>Coupled</h3><p>This is the most obvious choice. A coupled Drupal site means that all of your site is being rendered through Drupal. You are using twig templates, the Drupal render engine and Drupal as the data provider without the use of webservices. This is how we are building Drupal sites for a long, long time now. So nothing changes.</p><h3>Progressively decoupled</h3><p>Sometimes you need JavaScript to be able to create a higher interactive experience for the end-user then you can through default Drupal. You need a JavaScript framework on top of the existing Drupal theming layer to be able to create that. In that case Progressively decoupled (or hybrid decoupled) comes to the stage. The JavaScript can be made responsible to render parts of the website from blocks and and parts of the page to the complete page. For those parts data is retrieved from a webservice, either provided by Drupal itself, or a external API.</p><h3>Fully decoupled</h3><p>Fully decoupled Drupal reflects a complete separation from the user interface and the CMS in the backend. This means that Drupal is nothing more than just a data provider to a JavaScript application build with a framework like (for instance) React. The frontend is fully responsible for rendering and markup for the data provided by Drupal and it’s webservices.</p><p>When you are a developer who wants greater control over the frontend this is the most appealing option.</p><p>A fully decoupled website also makes it possible for you to generate fully decoupled static sites. The static site generators (like <a href="https://www.gatsbyjs.org/">Gatsby</a>) retrieve content from Drupal, generate a static (HTML version) of the website and deploy the site.</p><h3>When to use (progressively) decoupled (or not)</h3><p>One of the first things you need to do before deciding what technique to use is to determine what you are going to build and for who.</p><p>Let’s be clear, for single instance websites it might not be the best choice to go (fully) decoupled. However even single instance websites may need some parts, or even the complete website to be decoupled. Just because you want to be able to give the end-user the best possible interactive experience.</p><p>If your customer requires you to build more then 1 web applications (corporate websites, online working environments, etcetera) a decoupled Drupal could be the perfect fit. You can use it solely as a content repository that provides data to several consumers, or even use Drupal as a coupled environment that also exposes the content to other consumers.</p><p>When building a omnichannel experience where you need to be able to provide content to both web and non-web applications (like native mobile apps) you can use Drupal solely as a content repository that provides the content for all those consumers. Maybe even part of the infrastructure behind a ESB or ETL.</p><p>The nice thing about doing decoupled with Drupal is that it can provide them all. And they are (in most cases) not mutually exclusive.</p><p>When making the choice to go for decoupled you need to have answered some questions for yourself.</p><p>Are there things the project cannot live without? Think about editorial needs like the need to preview unpublished or draft content, in-context tools like the in-place editor or contextual links. If so then a fully decoupled site will probably not be the best outcome for you. You will need to rebuild all those features in the JavaScript framework of your choice which can end up in large, un-maintainable applications that cost more time to develop then the effort is worth.</p><p>If the project needs to access data from multiple sources via an API you are probably best of using a progressively decoupled site. This way you can use the Drupal theming layer to render the content provided in Drupal, and partially use decoupled “widgets” that show the data provided by the different API’s.</p><p>The choice to go for a fully decoupled site is mainly based on developer and/or user experience needs. One simple reason can be if you don’t have any frontend developers employed that have knowledge of the Drupal theming layer and Twig and you do have JavaScript developers that are able to create the frontend in (for instance) React.</p><p>Again, these options are not mutually exclusive and fixed for the future. Even if you create a coupled Drupal website you can eventually expose it’s data and use a client like a mobile app or a web application to retrieve that data. You can even build a complete new decoupled frontend for the existing website without to much hassle for the Drupal developers.</p><h3>Why should I decouple?</h3><p>In last few years I’ve heard several developers say that decoupled Drupal was the way to go. But is it? What are specific advantages of going fully decoupled?</p><p>One of the biggest advantages of decoupled Drupal is the possibility of the improved user experience. When using a JavaScript framework it’s easy to use transitions between page changes, you don’t have any page loads, data can be loaded asynchronously, etcetera.</p><p>When decoupling Drupal you can do independent upgrades of the visual design without any backend changes. Just re-use the same API’s and redesign and rebuild the site and everything should be fine. The same goes for the backend. As long as the output of the API stays the same, the frontend should be able to keep running when replacing the backend.</p><p>You are not all reliant on Drupal developers. For me as a Drupal developer, this is hard to say, but when building a decoupled Drupal site you need less Drupal specialists. Just because the frontend isn’t built in Drupal and there is a clear line between the frontend and the backend.</p><p>Content creators can focus on what they can do best, create content. They don’t have to be focussed on how the content eventually will look because the consumers (mobile apps, websites, etc) are responsible for this.</p><p>The API’s can grow to bigger and be consumed by multiple consumers without worrying about the frontend. The API is documented and can be made available to your other projects, third-parties or the public with not much effort.</p><h3>Why shouldn’t I decouple?</h3><p>In last few years I’ve heard several developers say that decoupled Drupal was the way to go. But is it? What are specific disadvantages of going fully decoupled?</p><p>What you need to understand is that a coupled website is simple architecture. You only have 1 system, namely Drupal that you need to maintain, understand and debug. When you move to a decoupled architecture you need to keep in mind that it is more complex. You need to maintain multiple systems, need to understand what’s going on between them, and finding bugs gets more difficult because you need to figure out where the bug is actually coming from.</p><p>When maintaining and adding functionality to the decoupled application you need to be able to keep in mind that there is a strict separation of responsibilities between the systems. You should not add display logic to the webservices. This prevents circular dependencies, and prevents you from being able to swap CMS-es.</p><p>When you are used to developing coupled websites with Drupal you are used to the out-of-the box functionality that Drupal contributed modules give you. Modules like “<a href="https://www.drupal.org/project/views_infinite_scroll">Views infinite scroll</a>”, “<a href="https://www.drupal.org/project/redirect">Redirect</a>” or “<a href="https://www.drupal.org/project/google_tag">GoogleTagManager</a>” all have integrations with the frontend, and some even with Drupal users and permissions. All these functionalities need to be re-written in the frontend.</p><p>When using forms in the website, and in particular using webforms or the cores contact module, you need to rebuild the rendering, validation and submitting functionality in the frontend. While Drupal takes care of this by itself, you also need to get CSRF tokens because Drupal won’t accept POST requests without them.</p><p>Next to the contributed and form functionalities, you also need to keep in mind the basic core functionalities. When your end-users need to be able to view restricted content, so they need to log in, you need to be able to build a safe authentication method. Also editors aren’t able to preview the content to see how it looks like on the actual site. Well, they can, but then you need to create the frontend in Drupal, and that beats the decoupled purpose.</p><p>UI translations are something else, this is a functionality that has to be built yourself. While Drupal provies this (you can translate all kinds of UI strings) that just works on multilingual sites.</p><h3>How do I decouple?</h3><p>How to decouple is partially based on your own preferences. You have multiple options to choose from when choosing technologies for the backend (what webservice for instance) and the frontend.</p><h3>Frontend techniques</h3><p>This is probably the easiest choice. This is largely based on personal preferences or company based choices. Whether you use React, Vue, Angular or whatever JavaScript technique is totally up to you. They all can work in (progressively) decoupled architectures and can all, in some way or another, work with every backend decision you make.</p><p>Part of this decision is deciding if you want to use a static site generator like Gatsby. <a href="https://www.google.com/search?q=benefits+static+site+generator">Google</a> to see what the benefits are of this option, in this article I won’t go into depth in this topic.</p><h3>Backend techniques</h3><p>Here you have multiple picks that each have their ups and downs. I will mention a few of them. But this isn’t a full list of options.</p><p>When working with Drupal version &gt; 8.7 you have the option of JSON:API in core (older versions can use the <a href="https://www.drupal.org/project/jsonapi">JSON:API module</a>). JSON:API exposes all entities in Drupal in the <a href="https://jsonapi.org/">JSON:API specification</a>. However, this doesn’t give you everything, because not everything is a entity. But this is something you can overcome.</p><p>You can use the <a href="https://www.drupal.org/project/graphql">GraphQL module</a>. This makes it possible to execute GraphQL queries on Drupal and retrieve your content, menus, etcetera like that. Lots of frontend frameworks have plugins or modules that you can use to execute these queries. <a href="https://www.apollographql.com/">Apollo GraphQL</a> is one of them.</p><p>Another option is to build the REST services yourself. Drupal makes it possible for you to easily create REST resources in where you can write your own functionality just the way like or need it. This is possibly the most work intensive choice, but does yield the most specific result for your application.</p><h3>Authentication</h3><p>What you don’t want is a webservice that is open to everyone. You can <a href="https://drupal.stackexchange.com/a/247816/33743">enable and configure CORS</a> (and you should), but you should also use authentication.</p><p>Drupal out-of-the-box provides two kinds, either via cookies or via basic authentication. For decoupled basic authentication is the only one of the two you can use. With this method selected you just send a extra Authorization header on each request with the encoded username and password of the user you want to use. When your backend contains sensitive information, or content that shouldn’t be available for everybody, this might not be the most safe method. The username and password are encoded via base_64, so can be decoded easily.</p><p>A better way to provide secure authentication is through oAuth or key authentication.</p><p>For oAuth there are multiple contributed modules on Drupal.org (<a href="https://www.drupal.org/project/project_module?f%5B0%5D=&amp;f%5B1%5D=&amp;f%5B2%5D=im_vid_3%3A74&amp;f%5B3%5D=drupal_core%3A7234&amp;f%5B4%5D=sm_field_project_type%3Afull&amp;f%5B5%5D=&amp;f%5B6%5D=&amp;text=oAuth&amp;solrsort=score+desc&amp;op=Search">take a look at the list on d.o</a>). With oAuth it is possible to use per-user authentication, let access tokens expire, and lots more. This is a perfect method to use for user authenticated environments like intranet applications because tokens gets expired after a period of time and users need to refresh them what can only happen if they have a session in Drupal.</p><p>Key authentication works in a different way. You can see this as API keys for Drupal. A user can generate a API key for itself and this can be used in the frontend application to access webservices. Unlike oAuth this key doesn’t expire after time, but can be revoked by the user, or a admin user. This is perfect if you have non-personalised data you want to expose via the webservices and works like every other API key like you can generate for, for instance, Google Maps.</p><h3>Is decoupled the holy grail?</h3><p>Short answer: no.</p><p>Long answer, no but… In some cases (progressively) decoupled Drupal is certainly the way to go. Especially if you have a omnichannel architecture, decoupled fits really well. And in some cases it’s just too much.</p><p>As far as I’m concerned you need to look at every project separately and determine for each project if you need it to be decoupled, and if so, in what kind of form and shape. And if in doubt, do not decouple. You can always make the choice to decouple on a later stage, or to expose webservices from Drupal to consumers that are built later on.</p><p>The answer to the question is too dependent on too many unknown conditions. Are there frontend developers with Drupal and Twig knowledge, are there frontend developers with knowledge about the JavaScript framework you want to use, do you want to use functionalities from Drupal contributed modules, do you already know about future consumers, and I can think of a lot more questions.</p><p>For me decoupled Drupal is really great. A nice developer experience and you can build great interactive applications and I really love learning and building in that way. However, I’ve also learned (the hard way) that it’s maybe not always the best way to go. And can give you a lot of stress, more complexity, and a maintenance headache.</p><p>Just investigate, see what you want, what your team wants and can do, what your customer expects and wants and take a look at future plans, if there are any. Just make sure that your decision isn’t based on how hyped a certain technology is.</p><p><em>This post was initially publish on June 30, 2019</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65af7d33d990" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular baby steps]]></title>
            <link>https://medium.com/@fabianderijk/angular-baby-steps-78dbeba233a8?source=rss-1882bd83ef29------2</link>
            <guid isPermaLink="false">https://medium.com/p/78dbeba233a8</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[angular2]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Fabian de Rijk]]></dc:creator>
            <pubDate>Thu, 05 Mar 2020 18:44:08 GMT</pubDate>
            <atom:updated>2020-03-06T07:03:15.408Z</atom:updated>
            <content:encoded><![CDATA[<p>Some time ago, I started reading about Angular. Sure I’ve heard about it, I even did a tutorial. But somehow I just couldn’t get into it. But then I read about Angular2. The new version, and a complete rewrite. It became a object-oriented framework. While I was reading blogs and news posts about it I became more and more interested and intrigued.</p><p>By that time, the Angular2 quickstart on <a href="https://angular.io/">angular.io</a> wasn’t ready, so I just had to do with small examples which was hard. Very hard. Angular2 was still in a early beta stage and was prone to changes in important functionalities. But when the quickstart came online, I was kicking my heels up with joy. I made my first Angular2 application called the “Tour of Heroes” (the quickstart hasn’t changed ever since)!</p><figure><img alt="Angular logo" src="https://cdn-images-1.medium.com/max/1024/1*YDieAZR1wZL_4KfUsyqwFg.jpeg" /></figure><p>So what now? I’ve got an application that does something with heroes, but it is not persistent, it doesn’t look all that good, and it’s not something I can put online. So I started working on my own website. Because I know Drupal, I started creating a Drupal 8 backend that had some webservices so I could connect my Angular2 frontend to it.</p><h3>The beta struggle</h3><p>So now, I could start the Angular app, but doing that, I figured out that the beta version was still under heavy development. Some days I wanted to work on the application stuff just didn’t work anymore. And when you read the developer documentation at <a href="https://angular.io/">angular.io</a> it should work… And when I googled, I found all kinds of answers, and all different, and most of them just didn’t work. Sigh…</p><p>So that took a lot of work. When I wanted to navigate different pages in my site I first needed to use the router module, and then the router-deprecated module was the way to go, and then it became the router module again. But I needed to install a newer version using the node package manager (NPM). That one couldn’t find all its dependencies, an even bigger sigh…</p><p>This is just one example of the many more I encountered and by that time I wondered why I even started looking at Angular2.</p><h3>Releasing the struggles</h3><p>But then, as if it was meant to be, the <a href="http://angularjs.blogspot.nl/2016/09/angular2-final.html">final release version of Angular2</a> became public! September 15th 2016 will be a special day for me! After the final release all the struggles disappeared as if they were never there. The documentation was updated, when you Google you can actually find relevant stuff, and no more errors!</p><p>And to make it all even better, we at <a href="http://www.finalist.nl/">Finalist</a> just did a tender for a Drupal 8 backend and Angular2 frontend portal! So now it’s just not hobby anymore, it’s actual work.</p><h3>What makes Angular2 great?</h3><p>Angular2 for me is a great framework to work with. But why? For me it’s mainly the gentle learning curve, the way the files can be structured, the ease of working. I just didn’t find these when working with ReactJS. Which is a great framework as well. Maybe in the future I will adopt both, but for now it’s Angular2.</p><p>In just a few weeks really working with this framework I was able to create a modular, component driven portal, that requires a user to login, do authorized calls to web services, render JSON output to nice HTML. I learned a lot of Angular2 (and obviously Typescript).</p><h3>How about the techy stuff?</h3><p>I’m coming to that now. I will show you some pointers and examples I use or used.</p><h3>Angular2 101</h3><p>If you ever want to start doing Angular 2 I would recommend starting with the <a href="https://angular.io/docs/ts/latest/tutorial/">Tutorial: Tour of Heroes</a>. That is great to start with, and teaches you lot’s of stuff to make you go further.</p><h3>Angular CLI</h3><p>When you have finished the tutorial you really need to look at <a href="https://github.com/angular/angular-cli">Angular CLI</a>. It’s a command line tool which makes it possible for you to create angular projects, angular components, services, pipes and so on.</p><p>One of the main features though why I started using this tool was the availability of environment specific setting files, and the ease of use of them. Angular CLI creates a possibility to create a list of variables or settings that you can use on different environments like your development machine, the test server or the production server (or many more, you can add them yourselves).</p><p>You can just add line to the environment node in the angular-cli.json file like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a7e45dd0485cafe2c1d8c300868ca35/href">https://medium.com/media/4a7e45dd0485cafe2c1d8c300868ca35/href</a></iframe><p>For example, for us each file has a debugging value which we use to show data in the console window. This is true in the development file, and false in all other.</p><p>This is the example of a file used for development:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a967b583db06767a795580d2773b6ac/href">https://medium.com/media/2a967b583db06767a795580d2773b6ac/href</a></iframe><p>When you want to deploy your application to a certain environment you can use a command to build in (for instance) Jenkins: ng build --env=test. This builds the app using the environment variables from the file defined for the test environment. Nice! And a real lifesaver. In lots of use cases you need this.</p><h3>Use a generic service</h3><p>Services are reusable classes which you can inject in components to use their methods. This way you can reuse methods which you would copy from component to component otherwise. Often you have certain functions that you use in a lot of components, but you (or at least I) do not want to create a service that only have 1 method.</p><p>So I started creating a generic service which is injected in almost every component. Below are a some of the examples.</p><h4>Debug messages (based on the debugging environment value):</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1186cd571e2dc097d734bba513c58e0b/href">https://medium.com/media/1186cd571e2dc097d734bba513c58e0b/href</a></iframe><h4>A function that checks if a variable is an object:</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f84724256612effd49da5127d764dd71/href">https://medium.com/media/f84724256612effd49da5127d764dd71/href</a></iframe><h4>Generate an array from an object:</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c4065749d3746c2ddc101bca4570382/href">https://medium.com/media/4c4065749d3746c2ddc101bca4570382/href</a></iframe><p>These are just some of the examples. But I would like to recommend everybody to make use of a service like this.</p><h3>Caching of request results</h3><p>Sometimes you want to cache the results you get from a webservice. In the portal we created we show, amongst others, the name of the logged in user. And, you just don’t want to make a request to the webservice on every page. So, I created a way to cache the data for as long as you do not refresh the page (changing pages using Angular2 routing does not refresh the page, it just reloads components).</p><p>Before every request I check if there is a cached value (based on the webservice request url) and if it’s still within the TTL. If so, we return the cached data, else we do the request and cache the data again.</p><p>Below is an example of the functions I use.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b9b1b625b4ad3bc7afdddf2bd059874f/href">https://medium.com/media/b9b1b625b4ad3bc7afdddf2bd059874f/href</a></iframe><h3>What now?</h3><p>There is a lot more to tell about Angular2. And there is still a whole lot more to learn for me. I’ve gained some interest in <a href="https://www.nativescript.org/">Nativescript</a> to create mobile apps based on Angular2, and want to create more sites, portals and intranets using Angular2.</p><p>If you want to know more, please contact me on <a href="/service/mailto:fabian@finalist.nl">fabian@finalist.nl</a>.</p><p><em>This post was initially publish on December 7, 2016</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78dbeba233a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance boosting in Drupal 8 just got better]]></title>
            <link>https://medium.com/@fabianderijk/performance-boosting-in-drupal-8-just-got-better-8c34c905f044?source=rss-1882bd83ef29------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c34c905f044</guid>
            <category><![CDATA[bigpipe]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[drupal-8]]></category>
            <category><![CDATA[drupal]]></category>
            <dc:creator><![CDATA[Fabian de Rijk]]></dc:creator>
            <pubDate>Thu, 05 Mar 2020 18:38:23 GMT</pubDate>
            <atom:updated>2020-03-06T07:03:41.759Z</atom:updated>
            <content:encoded><![CDATA[<p>With the release of Drupal 8.1 on April 20th the BigPipe module was added to core to increase the speed of Drupal for anonymous and logged in visitors.</p><h3>What does BigPipe do in general?</h3><p>BigPipe is a technique to render a webpage in phases. It uses components to create the complete page ordered by the speed of the components themselves. This technique gives the visitors a feeling that the website is faster then it may actually be. Thus giving a boost in user experience.</p><p>This technique, originally developed by <a href="https://www.facebook.com/notes/facebook-engineering/bigpipe-pipelining-web-pages-for-high-performance/389414033919">Facebook</a>, deploys the theory of multi threading, just like processors do. It disperses multiple calls to a single backend to make full use of the web server and thus rendering a webpage faster then conventional rendering does.</p><h3>What does BigPipe do in Drupal?</h3><p>For “normal” websites with anonymous visitors, BigPipe doesn’t do much. If you use a caching engine like Varnish, or even Drupal cache itself, pages are generally rendered fast enough. When using dynamic content like lists of related, personalized or localized content BigPipe can kick in and really make a difference. When opening the website BigPipe returns the page skeleton that can be cached. Elements like the menus, footer, header and often even content. And then rendering of the dynamic content will start. This means that the visitor of your website is already reading the most import content, and is able to see the dynamic related list later on after it’s loaded asynchronously.</p><p>For websites with logged in users BigPipe can be a real boost in performance. Standard Drupal cache doesn’t work out of the box for logged in users. For Drupal 7 you had the <a href="https://www.drupal.org/project/authcache">Authenticated User Page Caching (Authcache)</a> module (which had some disadvantages), but for Drupal 8 there was nothing. Until Drupal 8.1!</p><p>With BigPipe Drupal is now able to cache certain parts of the page (the skeleton which I mentioned above) and to multithread some other parts. And these parts are cacheable by themselves.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJwzX0Qv6u3A&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJwzX0Qv6u3A&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FJwzX0Qv6u3A%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/742f6063f5181ade76b179c5017f2687/href">https://medium.com/media/742f6063f5181ade76b179c5017f2687/href</a></iframe><h3>BigPipe in Drupal</h3><p>As I said, starting from Drupal 8.1. BigPipe is added as a core module. And everybody can use it. Whether you are using a budget hosting platform or you are hosting your own website with state-of-the-art servers, it is basically just one (1) click away. You can just enable the module and get all the benefits BigPipe has to offer!</p><p><em>This post was initially publish on May 4, 2016</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c34c905f044" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Answer to The Ultimate Question of Life, the Universe and Drupal]]></title>
            <link>https://medium.com/@fabianderijk/the-answer-to-the-ultimate-question-of-life-the-universe-and-drupal-d37fdc52cd6c?source=rss-1882bd83ef29------2</link>
            <guid isPermaLink="false">https://medium.com/p/d37fdc52cd6c</guid>
            <category><![CDATA[drupal]]></category>
            <category><![CDATA[theming]]></category>
            <category><![CDATA[frontend]]></category>
            <dc:creator><![CDATA[Fabian de Rijk]]></dc:creator>
            <pubDate>Thu, 05 Mar 2020 18:34:28 GMT</pubDate>
            <atom:updated>2020-03-06T07:04:10.673Z</atom:updated>
            <content:encoded><![CDATA[<p>What if we had a Drupal theme that does exactly what we want? No more divs, in divs, in divs. No more weird css. Out of the box responsiveness, both adaptive as fluid. Debuggers, good javascript additions, Gulp. Maybe even a little styleguide generator.</p><p>That’s what we thought when we started working on our own custom Drupal starter theme in July 2013. We called it “<a href="https://www.drupal.org/project/fortytwo">FortyTwo</a>”.</p><h3>A brief history</h3><p>Before we we started working with <a href="https://www.drupal.org/project/fortytwo">FortyTwo</a>, we did theming, like many others, based on the Zen or Omega base themes. It worked, it got us where we wanted, but it had its downsides. Besides Zen we also looked at Omega and other major base themes. They all had their pros but also a lot of cons.</p><p>During a talk I had with one of the frontenders at Finalist about this we started to think: Why not create our own theme. Let’s combine all of the pros from all those themes to one, and maybe add some other nifty features.</p><h3>The start</h3><p>The first ever site we developed with <a href="https://www.drupal.org/project/fortytwo">FortyTwo</a>, and the site that actually developed a big part of FortyTwo was the Finalist website. Back then it was a good starting point for us to develop website frontends the way we wanted to. Combined with good backend developers we could start working on good frontends.</p><figure><img alt="Finalist.nl" src="https://cdn-images-1.medium.com/max/1024/1*kMr1A5-MR6RCI9HmzX6iaw.png" /></figure><p>Because we developed <a href="https://www.drupal.org/project/fortytwo">FortyTwo</a> as a base theme for Drupal we could use it to create all kinds of different websites, no matter the shape or size.</p><h3>Features</h3><p>Let me enumerate some of the best features <a href="https://www.drupal.org/project/fortytwo">FortyTwo</a> has right now:</p><ul><li><em>SASS;</em> FortyTwo has completely been made using the SASS css preprocessor.</li><li><em>Drush integration;</em> Easily create your sub theme using our custom drush command.</li><li><em>Out of the box responsiveness;</em> Without no effort themes developed using <a href="https://www.drupal.org/project/fortytwo">FortyTwo</a> are responsive. Both adaptive or fluid. Extending the responsiveness is easy by just copying some files. Want to change the breakpoints? They are defined in the sass settings file.</li><li><em>Gulp;</em> We have added gulp support for some extra features.<br>- SASS watch and compiling with auto prefixes for IE8 and IE9.<br>- JSLint integration, while watching the theme folder the console will output errors or warnings from JSLint if there are any.<br>- Uglify of JavaScript files.<br>- Clearing of Drupal cache on changes in PHP, include or info files in the theme.<br>- And last, but not least automatic reloading of the browser on file changes.</li><li><em>Icomoon integration;</em> For easy development we have created a starter set of icomoon icons and added them to the theme. You can easily extend those icons and use theme using our custom icomoon SASS mixin.</li><li><em>Layout styles;</em> It is possible to choose different styles of layout, whether you want your content column on the left, right or the middle, it is just a setting;</li><li><em>Debuggers;</em> We have added some handy debuggers in <a href="https://www.drupal.org/project/fortytwo">FortyTwo</a>:<br>- It is possible to show the grid on the background of the page. The grid uses the settings set in the sass settings file.<br>- It is possible to show a responsive identifier. This makes it easier to create responsive websites. A bar at the bottom of the website shows you on what breakpoint you currently are viewing.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x5zxOAnSNyMEEqWERYicgg.jpeg" /></figure><h3>Drupal 8</h3><p>Since August 2015 we have also started developing the Drupal 8 version of the theme. Since Drupal 8 is becoming the new standard we wanted to be ready for it when it came out. On the date Drupal 8 was officially released <a href="https://www.drupal.org/project/fortytwo">FortyTwo</a> was already finished and is now in active development.</p><h3>How about the future?</h3><p>We are still in active development. Since the release of FortyTwo-8.x-1.0 Only bugfixes and really nice features are added to the Drupal 7 version of FortyTwo. Other new features are only added for Drupal 8.</p><p>On the roadmap are:</p><ul><li><em>KSS;</em> Knyle Style Sheets integration. Using KSS you can automatically create style guides from CSS and SASS.</li><li><em>FortyTwo admin theme;</em> Admin themes are always difficult to pick. Because we work with a lot of clients, different kinds of content and content managers we believe that we can create a admin theme (of course based on <a href="https://www.drupal.org/project/fortytwo">FortyTwo</a>) that suits the needs of everybody.</li><li><em>FortyTwo example theme;</em> Since the start of development we always wanted to create a example theme that everybody can use, out-of-the-box.</li></ul><h3>Get involved!</h3><p>Yes, we would love to see you around on the <a href="https://www.drupal.org/project/fortytwo">project page</a> and the <a href="https://www.drupal.org/project/issues/fortytwo">issue queue</a> ! We heavily depend on your input, testing and feedback, but also on your commitment as a community developer, by helping us implementing new features and fixes.</p><p><em>This post was initially publish on May 1, 2016</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d37fdc52cd6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>