<?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 Santhosh Raju on Medium]]></title>
        <description><![CDATA[Stories by Santhosh Raju on Medium]]></description>
        <link>https://medium.com/@santhoshraju2?source=rss-c36e1f96c68d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SC9ZFD8rdnuQiZAn.jpg</url>
            <title>Stories by Santhosh Raju on Medium</title>
            <link>https://medium.com/@santhoshraju2?source=rss-c36e1f96c68d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 20:18:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@santhoshraju2/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[Creating an optimised tailwind.css bundle in Create-React-App]]></title>
            <link>https://medium.com/@santhoshraju2/creating-an-optimised-tailwind-css-bundle-in-create-react-app-f622635243a9?source=rss-c36e1f96c68d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f622635243a9</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tailwind-css]]></category>
            <dc:creator><![CDATA[Santhosh Raju]]></dc:creator>
            <pubDate>Sat, 23 May 2020 15:18:32 GMT</pubDate>
            <atom:updated>2020-05-23T15:18:32.482Z</atom:updated>
            <content:encoded><![CDATA[<p>Let me start off by saying that I really love using tailwind.css. Even though I’m not a designer, I can confidently build a beautiful and professional looking website / web application easily with tailwind.css and the best part is their tailwind config that characterises a design system.</p><p>Starting off and building an application with tailwind.css is pretty easy, but what comes after is where most of us fail to realise i.e the <strong>bundle size.</strong></p><p>For some of them it might not be a concern, but when your building an optimised web application this metrics is what defines whether your application is really optimised or not.</p><p>So I begin by creating a React boiler plate with Create React App (CRA).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*Q4BWQlZNqLW1wokFQC0_8A.png" /></figure><p>Now we have a boilerplate for building React application, let me first remove some of the default stuff from the boiler plate to make things easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*106lLucBF3VOmJp1WGtlbw.png" /></figure><p>This is what is left and the index.css is empty. Because we will using tailwind.css which I will show you in just a bit.</p><p>By running the application, this is pretty much what the application renders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o8DT7ac0xJC3q89tUoCGvQ.png" /></figure><p>Now let’s add tailwind.css. I’m configuring it with postcss, for this you don’t need to run eject on your CRA. Let’s keep it simple!!</p><p>yarn add postcss-cli tailwindcss autoprefixer -D / npm install postcss-cli tailwindcss autoprefixer --save-dev</p><p>Create a file postcss.config.js in your project root folder with the below configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*txnJ_AdV5hh30wSYRTc-Mg.png" /></figure><p>Now all that is left is to run postcss. For this I add a npm script in my package.json as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*qJdxsBcSks9HQEYfRxfgJg.png" /></figure><p>build:style script, all it says is run postcss with the input file as src/styles/tailwind.css and output it (-o) to src/index.css.</p><p>So let’s create the required tailwind.css file in src/styles folder with the below content</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*XMp42MZ6as4krfmTM18ykQ.png" /></figure><p>That’s it, now let’s run the application and see the change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h_0kLOZHQMDEKeBHztM6LQ.png" /></figure><p>Okay, you may not be able to see much of a difference than the previous one, but trust me the font-family changed. Let me add something that shows you the difference and make you believe that tailwind.css is indeed configured.</p><p>Open src/App.js and edit it with the below content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A_r2TeUGPZR3x92TP4hX0A.png" /></figure><p>Let’s check what is rendered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eDRqTe6SOq_Lut5Fd1hvkw.png" /></figure><p>Believe me now!! Just like that, without even writing a single line of css we are able to add styles to our elements.</p><p>Let’s build the application for production with yarn build or npm run build. Take the build folder and deploy it to any static server. You should basically see the same result.</p><p>Now this is where we fail to realise, we fail to check how optimised our application is.</p><p>When I deployed it to a static server and this is the css file size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sen30nLIDgs3Rr0GdGq2Pg.png" /></figure><p>Yikes!!</p><p>Even though our css is minified, we are shipping 1.5MB of css. Between us, if my architect saw this, which he always does, he will say to throw this application to garbage. No matter how professional and beautiful the UI would be.</p><p>So let’s fix it with a postcss plugin @fullhuman/postcss-purgecss . Let’s first install it.</p><p>yarn add @fullhuman/postcss-purgecss -D /npm install @fullhuman/postcss-purgecss --save-dev</p><p>Edit the postcss.config.js with the below content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*Kgv3XBxwufsGNma_CJ9GGg.png" /></figure><p>What it does is, it stripes out most of the unused css classes that tailwind generates for us, by matching the regular expression we have specified in the defaultExtractor on the files we mentioned in the content section / content array. This doesn’t convert / parse your files, it just looks up the css class names it should keep and discard the rest.</p><p>Now let’s build the application and deploy it to static server once again, and check the file size it generated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1imK-qATmsg1uSBSYAh_WQ.png" /></figure><p>Woah!!, this is huge improvement from 1.5MB to 1.1kB. That is huge.</p><p>Of course this will increase when you use more class names that tailwind offers. But we can agree that we would only use a subset of the tailwind.css class names, so let’s use only those and discard the rest and keep our build size minimum. Because most of the end users of our applications would not be having a super high speed broadband / ISP.</p><p>That it folks, thank you for reading. Please share it with your colleagues and dev friends. My goal is to have every knowledge shared and reached to as many as I can.</p><p>Thank you. And stay safe, stay indoors, keep learning and keep faith. It is tough times and this too shall pass. Take care ya’ll.</p><p>Learning Resources</p><p><a href="https://tailwindcss.com/course/optimizing-for-production/">https://tailwindcss.com/course/optimizing-for-production/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f622635243a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[window.close does not work in a way that you might think]]></title>
            <link>https://medium.com/@santhoshraju2/window-close-does-not-work-in-a-way-that-you-might-think-599034881399?source=rss-c36e1f96c68d------2</link>
            <guid isPermaLink="false">https://medium.com/p/599034881399</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[close]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[Santhosh Raju]]></dc:creator>
            <pubDate>Sun, 12 Jan 2020 16:01:09 GMT</pubDate>
            <atom:updated>2020-01-12T16:01:09.688Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*4IVk5qt9mlntD1qxnYgPJw.jpeg" /></figure><p>For once I thought that window.close Javascript API was fairly a simple one to implement, until one of my colleague asked me for help.</p><p>If you think that I’m overthinking on such a fairly simple API, well you might be surprised if you do not already know what I’m talking about.</p><p>For starters let’s define what the API actually meant, it simply means to close a current window or tab on the browser the user is interacting with, <strong>programmatically. </strong>This API gives you the ability to close the window via your code.</p><pre>function closeMyWindow() {<br>  window.close();<br>}</pre><p>Calling this function either by invoking the function or binding it to a DOM event should result in what we might think, hum…?</p><p>Even I had the same assumption, but unfortunately it does not work the way we might think it should work!!!</p><p><strong>So why does it not work ?</strong></p><p>If you check the MDN docs, they clearly mention window.close method can only be called by a window that were opened by a script using window.open or else we get a error on the console Script may not close window that were not opened by script.</p><p>According to specs (which is very difficult to read BTW), is that a window can be closed only if it’s browsing context — the Document object presented to the user — is derived from a top level browsing context / parent browsing context (reason for opening with window.open), so the session.history is not lost by presenting a single Document object. They do not have any intension of preventing XSS while designing this API, at least that is what I read from the specs, so do not think this is for preventing XSS attacks.</p><p><strong>So how to implement it ?</strong></p><p>Let me give you the same exact scenario we solved in our application.</p><p>On page A, we have a button called “publish”. On click of it we open the publish preview page, let’s say page B, on a new tab.</p><p>On page B, there are two buttons “Publish” and “Cancel”, on click of cancel it should close the window.</p><p>Contents of page A, let’s call it “index.html”</p><pre>&lt;!doctype html&gt;<br> &lt;head&gt;<br>  &lt;title&gt;Jupyter notebook&lt;/title&gt;<br>  &lt;script&gt;<br>   function openit(){<br>        window.open(location.origin + &#39;/child.html&#39;, &#39;__blank&#39;);<br>   }<br>  &lt;/script&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br>  &lt;h1&gt;Jupyter notebook instance&lt;/h1&gt;<br>  &lt;button onclick=&quot;openit();&quot;&gt;kh publish&lt;/button&gt;<br> &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Contents page B, let’s call it “child.html”</p><pre>&lt;html&gt;<br> &lt;head&gt;<br>  &lt;title&gt;Notebook edit&lt;/title&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br>  &lt;h1&gt;Notebook edit page&lt;/h1&gt;<br>  &lt;button&gt;Publish&lt;/button&gt;<br>  &lt;button onclick=&quot;window.close();&quot;&gt;Cancel&lt;/button&gt;<br> &lt;/body&gt;<br>&lt;/html&gt;</pre><p>That’s it, pretty simple right!!! Now you know a concept that might confuse you at first.</p><p>On a side note, our problem had a slight difference. Both the pages A and B were served on two different addresses, so we had to change the location.origin to the physical address serving page B. Which in this case proves that the design of the API was not to prevent cross site attacks.</p><p>Thank you so much for reading, as always I request you to share this to your friends and colleagues and across your channels. So this reaches to anyone who is facing a similar situation.</p><p>My intention is same as my motive <strong>“Knowledge is meant to be shared”, so please share it.</strong></p><p>References</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/close">Window.close()</a></li><li><a href="https://www.w3.org/TR/html52/browsers.html#dom-window-close">HTML 5.2</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=599034881399" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fixing my client-side routing]]></title>
            <link>https://medium.com/@santhoshraju2/fixing-my-client-side-routing-c0e4fccbd4a0?source=rss-c36e1f96c68d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0e4fccbd4a0</guid>
            <category><![CDATA[client-side-routing]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-router-dom]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[subdirectory-routing]]></category>
            <dc:creator><![CDATA[Santhosh Raju]]></dc:creator>
            <pubDate>Thu, 08 Aug 2019 14:24:54 GMT</pubDate>
            <atom:updated>2019-08-08T14:24:54.971Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, I am going to talk about my experience when implementing a client-side routing. I just wanted to point out that, this is not against any frameworks or libraries out there, but please see it or recognise this as the missing piece of information for helping our community</p><p>Again, this might not be a complete and the exact solution which you might be looking for. But a reference to the some of the problems you might encounter.</p><p>So, let’s begin</p><p>In this era of modern web development, the most sort after feature is client-side routing. Allowing us to build Single Page Application (SPA, as it is popularly called).</p><p>This kind of feature is agnostic to any frameworks or libraries out there, but those frameworks or libraries never miss out on having their own client-side routing in their ecosystem.</p><p>Regardless of any framework, the base or the logic implementing a client-side routing remains the same.</p><p>So what exactly is a client-side routing ?</p><p>It’s the same as server-side routing, but on the browser. That ability to change or tweak it’s content when url is changed without ever requesting the server for the content that it needs to render and without refreshing the whole page.</p><p>Implementing a client-side routing is done in two ways</p><h3>Hash based routing</h3><p>Hash based routing is implemented based on the anchor part of the url. For example <a href="http://example.com/#/product/list%60">http://example.com/#/product/list</a> displays a list of products on the page.</p><p>Focus on the #/product/list, as this part of the url is never sent to server. Allowing us to completely operate on the client-side.</p><p>Using this simple approach will help you implement client-side routing in your application, without any of the issues that I will be talking in a bit.</p><p>But, they are far from being perfect. They come with a weird concern, that their urls are not always very pretty.</p><p>For example, if you are tasked to implement a hash-based routing and anchor based scroll on your webpage ( i.e click on a anchor tag or a button and your are scrolled to the section of the page), the url will look something like this <a href="http://example.com/#/#pricing-section">http://example.com/#/#pricing-section</a></p><p>Not good right? But this gets even worse. You can add an external link to the url<a href="http://example.com/#/https://stackoverflow.com/questions/10190215/">http://example.com/#/https://stackoverflow.com/questions/10190215/</a> and it will still render your web page.</p><p>So was there a fix for this, yes there was via the form of <a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API">History API</a></p><h3>pushState routing</h3><p>Or more precisely, as it is called in the web ecosystem, <strong>BrowerRouter.</strong></p><p>With the release of HTML5, we got window.history.pushState(), this method works in conjunction with window.onpopstate event.</p><p>So, when we want to change the history entry or basically route. We make a call to window.history.pushState() by passing in the state, title (which is not so important and usually are ignored by the browsers) and the url itself. Which then fires the onpopstate event, where we may fetch the state object and finally render the section which was supposed to render.</p><p>This sort of routing is pretty popular in the client-side routing ecosystem and pretty simple to use (if application deployment is straight forward) and most of the framework and libraries entities adopting it as the go-to client-side routing mechanism.</p><p>But they come with a little disappointing drawback !!!</p><p>Let me stop blabbering and show you what I mean, with a real world example.</p><p>I’m using React and React Router DOM for explanation. But please, this is by no means I’m saying they are wrong and I’m trying to fix them or something. I just used them, because a large number of developers and company’s have adopted them.</p><p>Also thanks to React’s expressive way of presenting one’s code, this allows me to explain it in a much simple way and reaching wider audience.</p><p>So here we go!!.</p><p>First I created a react application via create-react-app, and added react-router-dom for client-side routing.</p><p>Created two routes <strong><em>Home</em></strong> and <strong><em>About, </em></strong>here are the screenshots for them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*qzLgCXsjBrx4UuxThuunqw.png" /><figcaption>Home with ‘/’ index as it’s route</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*bmPoOt__aVTqGdW45_iJ6w.png" /><figcaption>About with ‘/about’ as it’s route</figcaption></figure><p>I like to design a lot now a days, so I would like to direct your attention to the urls in the screenshot and observe them carefully, because this post actually revolves around them. The url changes when I click the “about” button, pretty obvious right.</p><p>So everything looks good and works great, now lets generate the production bundle and host it. For this example I chose to host it using node.js backend built with express.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*nLHmIMlDnPqWlhWUtJPFVg.png" /><figcaption>node express server, for hosting my website</figcaption></figure><p>Simple enough static server to host my website. You can choose any server language but what I’m about to explain still remains the same.</p><p>Now my backend server is ready, all I have to do is build my client application and copy the bundle to public folder on the server and start it.</p><p>Commands that I followed to do it are</p><p>yarn build &amp; copied the contents of the build folder to server/public with cp -R ui/build/ server/public/</p><p>So let’s start my server node index.js which starts listening on port 5000 if there are no errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*3THjylvgvhadH7VBEdm9OA.png" /><figcaption>serving on <a href="http://localhost:5000/">http://localhost:5000</a>, from the node server.</figcaption></figure><p>Hurray, everything works and I’m able to navigate to the “/about” route when I click on the “About” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0TWSOt6YR52lBXX0Jjs5Lw.png" /><figcaption>/about page when I click on “About” button</figcaption></figure><p>So it was a wrap, was ready to move onto my next project.</p><p>Buutttt.. my excitement was short lived, I found that there are so many issue that I never knew would pop up.</p><p>So what are those issues ?</p><p>I showed to my colleague and everything was working as expected until he showed me this error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*mD_k6ID8qxb9-gxD2zGcAw.png" /></figure><p>How did he get to this you ask ? Not so unusual way, just an everyday scenario where you refresh the page or you manually type the url.</p><p>Okay, so why is a problem. Is it my router package ? Nope.</p><p>The reason is your backend server, whereas in our case node server, does not have a defined /about route to respond, so it throws us the above error.</p><p>This is the disappointing drawback I was talking about pushState based routing.</p><p>It so happens that, when you are using a history or push state based client-side routing. You need to write an extra bit of code on the server to respond to those client-side urls when they are refreshed or typed manually.</p><p>Remember this is not the case with Hash based routing, because the hash part of the URL is never sent to server at all.</p><p>This is not new, has been there for a long time. But the part that pisses me off the most, is these client-side routing frameworks have failed to mention them in their documents as far as I read and you usually see them in some Github issues.</p><p>So, let’s fix it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*Bb5ECc7vJQ7PgOBd2f6aOQ.png" /><figcaption>added ‘/about’ route in the server</figcaption></figure><p>Added the /about route on the server, so it can respond. Once the initial page is loaded the react-router-dom takes care of navigating to the appropriate route.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*lnjdv2u1UU6EUUWwqE2v_g.png" /><figcaption>About page rendered, after adding the ‘/about’ route</figcaption></figure><p>Yes!!, it is rendering the screens and we are back on track now. I agree this is somewhat extra code. But you gotta do this in order to fix it.</p><p>But this has nothing to do with the node server or React or React-Router-DOM’s issue. This is how the behaviour of the History API is.</p><p>This would hold the same when you are using Vue, Angular, Ember or any framework or Python or Apache Tomcat servers out there. You need to define all your client-side routing on the server too.</p><p>But our problem was not yet over, in fact it got really complicated. Scenarios which I will be talking about would be a bit advanced, but I will try my best to explain them in a simple way.</p><p>In a typical project, there would be a dedicated server or virtual machines or server space with proper DNS mappings for hosting the website.</p><p>But in the system we are working on, we have a group of application servers clustered / grouped together to host all our applications with a Edge Gateway for proxying the requests to our application instances for scaling and service discovery.</p><p>To explain this, in a simple way I have created a diagram for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*445Aw2WBGyIvPhxy31LmKQ.png" /><figcaption>edge gateway for proxy the requests in front of application instances.</figcaption></figure><p>Since we have mappings to each of the application instance in our proxy config, when a user types http://localhost:8080/app/one the requests are proxied to the configured application instance.</p><p>These type of systems are very efficient for hosting multiple applications to utilise the full capability of a server. You usually find this type of setting in a micro-services architecture to be more precise.</p><p>Getting back to the problem at hand. With an environment setup like this, how will you make your application work ??</p><p>To explain this more practically, instead of words, I have setup a small environment just like the above with ngnix</p><p>If you don’t know about ngnix please head over here <a href="https://www.nginx.com/">https://www.nginx.com/</a></p><p>For this I have setup an nginx proxy server as a reverse proxy server listening on 8080, to proxy all my requests at a dedicated path to my application server listening on port 5000</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*qC-O87sjxAWO6FU-hsYlxA.png" /><figcaption>nginx config for forward proxying.</figcaption></figure><p>So what it basically says is, when I get a request from http://localhost:8080/app/one/ I need to pass it onto <a href="http://127.0.0.1:5000.">http://127.0.0.1:5000</a>. So let’s try to see if our website still works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U4xFnSShP-dFTXMRjqZIUA.png" /></figure><p>As expected it failed to render my website. Why? Because of our asset path bindings</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mlQlqiaaZM4nZqVZpnZFeg.png" /><figcaption>Asset bindings are absolute by default.</figcaption></figure><p>In the create-react-app, the assets bindings are absolute by default. And this is also been discussed in brief in one of the issues on their github project.</p><p><a href="https://github.com/facebook/create-react-app/issues/527">Building does not set relative paths to the assets in `static` folder · Issue #527 · facebook/create-react-app</a></p><p>So their solution was, to add a “homepage” configuration in package.json to make it relative like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*kRYed5a13mHcoaxStHPyXA.png" /><figcaption>add this config in package.json</figcaption></figure><p>I have added the fix as mentioned, let’s build it and restart my application server.</p><p>Did it work, yeah kinda of.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hJj7M9G-0Sh4VxLb__XRLg.png" /><figcaption>without default client route.</figcaption></figure><p>So what is happening? In this case what you are seeing is the header section of the application, the part of the application that is not under the influence of any client side routing.</p><p>We finally arrive at a point where we need to deal with the client side routing mechanism.</p><p>To make you understand clearly of what is the happening let’s click the about button, where we expect it to show me the about page right ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uqVGhiMLbAe1N6LYae2_gA.png" /></figure><p>Voila, it navigates. But not so soon, please observe the url. Yes, we are no longer within the confines of our subdirectory url http://localhost:8080/app/one/</p><p>At this stage when you or the customer refreshes the URL, they will only see a 404 error or in our case it is going to be the ngnix error. Because we have not configured anything at that path in our ngnix proxy server.</p><p>Reason, it behaves this is way because our client-side routes are always configured in the same exact way. The routes are always configured to work from the default route “/”.</p><p>Humm.. But no worries, our library have given us a way to fix it.</p><p>What you need to do is, know the subdirectory path and configure it a base-path for all our client side routing.</p><p>In case of React-Router-Dom they have given us an option to configure it, by passing basename as a prop to &lt;Route&gt; component like this.</p><p>In our case our subdirectory path is /app/one/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k5hMfj_fa7rTgVdsFJ1qeQ.png" /></figure><p>Okay, now is our application fixed ??</p><p>Yes of course it is fixed and all is working really well.</p><p>But I was faced with a bigger problem, what if the basename that you knew would be the subdirectory path or the base-path is unknown to you, worse they won’t be provided even at the build time.</p><p>In our system, we have a complete automated workflow. When you push / commit your code. Our CI build system kicks in, setting up our container instances, configuring the edge gateway and finally deploying the application. Our team, has eliminated the need for Devops person to manually deploy our code.</p><p>Good enough problem right, how would you fix that ??</p><p>Unfortunately, I fixed it. Why the unfortunate part ??</p><p>Because people started calling it a hack (in our way calling it a Jugaad) , but I call it a solution. If you deeply understand what we as engineers actually do is provide solutions to the problems thrown at us.</p><p>How did I fix, all of that in another post, promise I won’t take much time ? But if you need the solution right away please DM me on my twitter <a href="https://twitter.com/santhoshraju2">https://twitter.com/santhoshraju2</a></p><p>Didn’t want to make my post anymore longer and also the complexity of the problem at hand was huge.</p><p>Until then, thank you so much for reading. Hope this really helps all the developers out there facing a similar issue, and filling out the missing pieces of docs in our packages and libraries. And please do share, I basically would hate to see any developer facing a similar issue and wasting precious time in figuring out the solution, like I did.</p><p>Love you folks, cheers</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0e4fccbd4a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Realise your dreams]]></title>
            <link>https://medium.com/@santhoshraju2/realise-your-dreams-3215ec3eb688?source=rss-c36e1f96c68d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3215ec3eb688</guid>
            <category><![CDATA[poetry]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[dance]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[reading]]></category>
            <dc:creator><![CDATA[Santhosh Raju]]></dc:creator>
            <pubDate>Sun, 14 Oct 2018 13:33:53 GMT</pubDate>
            <atom:updated>2018-10-17T01:56:43.352Z</atom:updated>
            <content:encoded><![CDATA[<p>Before I could try and justify the title of my blog post, let me start off by telling you a little story.</p><p>A master had a buffalo. The animal’s widespread horns made him think that if he could manage to sit between the horns, it would be like sitting on a throne. One fine day, when the animal was distracted, he climbed up between the horns and did just that.</p><p>The buffalo, however, immediately stood up to its feet and threw him off.</p><p>When his wife saw this, she began to cry.</p><p>“Don’t cry”, said the master, once he recovered. He said “I may have suffered, but I also realised my dream”.</p><p>Whatever your dreams are, don’t lay them waste, make them your reality. Don’t worry about whether you would suffer or not.</p><p>No one knows the outcome before starting it.</p><p>But you sure would have the contentment and pride of saying, I did put in the efforts to <strong>“Realise my dreams”</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3215ec3eb688" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using command alias, to help dev workflow]]></title>
            <link>https://medium.com/@santhoshraju2/using-command-alias-to-help-dev-workflow-36917b27b490?source=rss-c36e1f96c68d------2</link>
            <guid isPermaLink="false">https://medium.com/p/36917b27b490</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[devlife]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Santhosh Raju]]></dc:creator>
            <pubDate>Fri, 14 Sep 2018 06:39:58 GMT</pubDate>
            <atom:updated>2018-09-14T06:39:58.529Z</atom:updated>
            <content:encoded><![CDATA[<p>I have been using the command alias for a while now, and it has been a boon in my web development workflow.</p><p>For those who are unaware of the command aliases, it is basically / mostly used (as I’m aware of) for shortening a long command.</p><p>Also, this makes you look cool when you type commands like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*vmU159ggsWG307R4EmrKHQ.png" /><figcaption>shorten version of `git branch`</figcaption></figure><p>And this is the reason for writing this blog, because I get asked this question a lot nowadays.</p><p>The thought of writing a blog and sharing it, for something which you are asked multiple times, is from my code hero and guru <a href="https://medium.com/u/db72389e89d8">Kent C. Dodds</a>.</p><p>Now back to what we ought to learn from this blog, so how do you setup command aliases, just like the one which I showed above.</p><p>Turns out it’s really not that complicated(depending on the Operating System)</p><p><strong>On Linux core system’s</strong></p><p>Let’s check how to setup command alias in Linux core systems (Mac, Ubuntu)</p><ol><li>Switch to user directory cd ~</li></ol><p>2. Create a .bash_profile or .profile, if you already have one of these files in your current directory. Then you can edit the files and add the alias commands at the end of the file.</p><p>3. The syntax for aliasing is pretty simple alias &lt;your-alias&gt;=&#39;&lt;command-to-be-aliased&gt;&#39;</p><p>For eg — I want to alias the 10 characters git branch command to 2 character gb, so my syntax would be alias gb=&#39;git branch&#39;</p><p>For completeness, I provide a screenshot of my simple alias below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*x2SqTG1MNg2hHDGcgAhGuQ.png" /><figcaption>my alias</figcaption></figure><p>Your preferences / command aliases need not match mine, I’m just sharing my preference as an example.</p><p>4. Final step, once you have built your aliases. You now need to run the .bash_profile / .profile so that your alias are registered and recognised by your OS.</p><p>To do that, run source .profile / source .bash_profile</p><p><strong>On Window’s based system’s</strong></p><p>Even with Window’s, it is quite simple and it’s just one simple command.</p><pre>doskey &lt;your-alias&gt;= &lt;command-to-alias&gt; $*</pre><p>The $* is optional, and it is used for command that take arguments.</p><p>For eg — git commit -m would want to take message as an argument, so you write the alias as doskey gc=git commit -m $*</p><p>If you want to persist the alias command, for every new session. I found a very helpful Stackoverflow answer, which helped me when I was using Windows machine.</p><p><a href="https://stackoverflow.com/questions/20530996/aliases-in-windows-command-prompt">Aliases in Windows command prompt</a></p><p>That’s it, you now can go ahead and use them, instead of typing long commands.</p><p>One more, main reason that I plan to share it is, I believe that automation or any small things like this, can really make a difference in our development time.</p><p>As a programmer, I think that our main focus would go into the product / features that we build and ship everyday and we hardly get enough time to debug the errors / code issues we run into. Which would take up most of our time and we eventually #burnout.</p><p>So having automations or time saving tools like this, can bring the burden down a bit and relive us, hard working programmers, from stress.</p><p>That’s it for now folks, if you like the blog and found it helpful. Please do share it to as many developer / programmers, who can benefit from this.</p><p>Also, I’m coming up with some more automation / dev workflow helping blogs like this, so stay tuned for more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36917b27b490" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quokkajs — Rapid prototying playground]]></title>
            <link>https://medium.com/@santhoshraju2/quokkajs-rapid-prototying-playground-12ba92cef79a?source=rss-c36e1f96c68d------2</link>
            <guid isPermaLink="false">https://medium.com/p/12ba92cef79a</guid>
            <category><![CDATA[repl]]></category>
            <category><![CDATA[rapid-prototyping]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[playground]]></category>
            <dc:creator><![CDATA[Santhosh Raju]]></dc:creator>
            <pubDate>Fri, 08 Jun 2018 07:19:23 GMT</pubDate>
            <atom:updated>2018-06-08T07:19:23.933Z</atom:updated>
            <content:encoded><![CDATA[<p>No, this is not yet another Javascript framework that is new and shiny, which most people are talking about.</p><p>But what this is, a great tool for rapid prototyping. Which I personally think that all developers needs to have in their in developer toolbox, or at least should be aware of.</p><p>Overtime, we developers tend to forget pretty small concepts in our programming languages, so we quickly head over to many online playgrounds like JSFiddle, Codepen, Babel’s REPL etc. to test our knowledge on these concepts or learn something new which haven’t heard off.</p><p>When I’m stuck at anything or trying learn something new, I directly to jump onto Babel’s REPL, open up the chrome developer console, adjust the console panel to the right and start off. Yep that’s what I do, to immediately learn or do something. Pretty awkward right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iGEE40mZGf0MJtZbI29E_A.png" /><figcaption>Babel’s REPL</figcaption></figure><p>Not anymore (sorry, babel I still love you), thanks to Quokkajs.</p><p>Quokka.js is available as extensions to major IDE’s like VSCode, Atom &amp; Jetbrains.</p><p>For the sake of this article, I will demonstrating it with VSCode, but everything remains the same in all supported IDE’s, expect for installation part.</p><p>Let’s first install it in VSCode, click on the extensions icon on the left side of VSCode, search for Quokka.js and install the extension. Please do restart / reload your VSCode editor to have immediate effect. That’s it, you now have a full fledged offline playground.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yvAHP5jbMKER9cTk9rI6DA.png" /><figcaption>Quokka.js extension on VSCode</figcaption></figure><p>To start press Ctrl/CMD + Shift + p, search and select Quokka.js: New Javascript file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y88v_LOMhKT2kAECI8RoaA.png" /><figcaption>Opening Quokka.js javascript playground</figcaption></figure><p>Now lets talk about it’s awesome features</p><p><strong>Output</strong></p><p>As soon as you open a new javascript playground, you will see a output terminal at the bottom of the editor like so. This is where all your outputs will be displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUjKO5HtQclfpUa4A736xg.png" /><figcaption>Output terminal</figcaption></figure><p>Once you start writing your code, at some point in time you need to know what is the value of a particular variable, you just need to write the variable in the next line, this will output in the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XcjrEs0Ec7MUHLmTcJgEjw.png" /></figure><p>If you decide to write console.log(arr) (which I do it so often), instead of variable in the next line, you get this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*PQ1BZ-Rv4xdqnmLKER6w1Q.png" /><figcaption>Inline output</figcaption></figure><p>Isn’t that cool, output is displayed inline. This is awesomeness.</p><p><strong>Code Coverage</strong></p><p>Yes, you heard me right there is code coverage. And you see them on the left side of the editor like so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K1sjp2pv-DDAvRTlwXsIaw.png" /></figure><p>As you see, if a particular statement is run, this is shown as green. If a statement is not run, this is shown as grey.</p><p>So if I’m writing an recursion function or practicing any algorithm, I get to know which statements would run based on a condition, or check if my condition is covered under certain condition.</p><p>And let me tell you all these things are live, and that is</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2FMixedFakeIchneumonfly&amp;url=https%3A%2F%2Fgfycat.com%2FMixedFakeIchneumonfly&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FMixedFakeIchneumonfly-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="798" height="540" frameborder="0" scrolling="no"><a href="https://medium.com/media/90d96d0784fee5c05cdfb782e276ac18/href">https://medium.com/media/90d96d0784fee5c05cdfb782e276ac18/href</a></iframe><p>There are other pretty cool features in Quokka.js like</p><ol><li>Project file Imports</li><li>Live commenting</li><li>Quick package install</li><li>Live Performance Testing.</li></ol><p>But these are available only in pro version, if you need to get more things done.</p><p>Just for a playground, community version of it plays really well for me.</p><p>To read more of its feature in detail, checkout their docs <a href="https://quokkajs.com/docs/">https://quokkajs.com/docs/</a></p><p>Thats it folks!!!</p><p>Thank you so much for reading, please do share and give a couple of claps. So it motivates me to write more awesome stuff, that I so love to share.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12ba92cef79a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I made my list for my Ember RoadMap2018]]></title>
            <link>https://medium.com/@santhoshraju2/i-made-my-list-for-my-ember-roadmap2018-c384aed442fe?source=rss-c36e1f96c68d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c384aed442fe</guid>
            <category><![CDATA[ember]]></category>
            <dc:creator><![CDATA[Santhosh Raju]]></dc:creator>
            <pubDate>Mon, 14 May 2018 08:59:21 GMT</pubDate>
            <atom:updated>2018-05-15T04:29:03.749Z</atom:updated>
            <content:encoded><![CDATA[<p>I was thinking a lot about the title of my post, and I felt like making a list of presents for my birthday, so here it goes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*oohcEJNHSI8VqftCFdQcyg.jpeg" /><figcaption>I made my list, for my birthday presents</figcaption></figure><p>I would like the ember-core team to picturize my blog as request for my presents.</p><p>I worked on Ember for the past 2 years, helping a major banking client in building a scalable application. Let me tell you, we went from ember 1.13 to 2.8 with TDD, to 2.10 with engines, to 2.14 with Glimmer and lazy-loading of engines, and the journey was amazing. And we integrated a react component in Ember, to get even more crazy we also integrated a whole react application with react-router into our Ember application and guess what this is actually live in production.</p><p>I love the ember-core team and also the ember-learn team, which helped me contribute to the ember-learn components project. The community is so welcoming and hard working in terms of helping its users out.</p><p>So here it goes.</p><h3>Lazy-loading of routes</h3><p>Yes, I know the obvious answer would be to use ember-engines. But for a simple application, wouldn’t it be really simple to provide lazy-loading / code-splitting within the core ember-routes API itself. Just a thought and would be really nice, if this is rolling out in the future versions of Ember.</p><p>Also, this would benefit a lot for beginners or someone who is new to the framework.</p><p>Would also like to point out that ember-engines is not officially released as a stable version, from my knowledge on follow ups on the ember-engines slack channel. So newcomers would have second thoughts and difficulties in working there way to support lazy-loading of routes.</p><h3>Using Webpack and documenting it</h3><p>When Sean Larkin joined the ember slack channel, I asked the obvious question out of my curiosity, whether ember is planning to move it’s build tool from broccoli to webpack. But that was not the plan, but someone is the channel did point out, that ember framework itself is not so opinionated and we are free to use webpack instead of ember-cli.</p><p>Agreed with the point, but there was no documentation for it. So would love to have ember using webpack as the build tool, because it is helping other frameworks solve problems and having documentation on ember-guides.</p><h3>Advocacy</h3><p>Apologies that I am sounding a bit harsh which is not my intention, all that I’m telling is my disappointment when Ember framework is not put up properly out there like other frameworks, even after the community is working so hard.</p><p>I see a lot of framework comparison blog post where they put the Ember framework at the less-leading section or completely ignored.</p><p>To get to know what truly is happening, I stepped to my managers and asked about how the application estimates and tech-stacks are chosen. He said most of the time, the tech stack is decided by clients and would always prefer Angular / React .</p><p>So I work in a consulting firm (one of #bigfour).</p><p>To point out, the client that I used to work for, have started migrating their entire codebase from Ember to React, reason being they are not able to hire people who know Ember and we as consultants are expensive for them as well.</p><p>So I was recently released of my current assignment and was asked to move on to any projects on the floor. When I queried for an ember project there was none.</p><p>Would love to have the ember-core team, take a deep look at this, because we have invested our time in learning the framework and just to find there is not so many opportunities outside. This is just my disappointment.</p><p>Finally I thank the whole team for all their hard work and help, would really like to hear some good news from the community for the RoadMap2018</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c384aed442fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[25 years and counting, with wonderful presents from Life.]]></title>
            <link>https://medium.com/@santhoshraju2/25-years-and-counting-with-wonderful-presents-from-life-916a1d0cb298?source=rss-c36e1f96c68d------2</link>
            <guid isPermaLink="false">https://medium.com/p/916a1d0cb298</guid>
            <category><![CDATA[mentor]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[friends]]></category>
            <category><![CDATA[love]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[Santhosh Raju]]></dc:creator>
            <pubDate>Tue, 11 Apr 2017 17:44:34 GMT</pubDate>
            <atom:updated>2017-04-11T17:53:20.363Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>They say that age is just a mere count that it adds to your life, but the things that a human can do, doesn’t depend on it.</blockquote><p>My 25 years of life so far, has nothing been just a learning throughout. Well I think, that is the only thing in this world that you would get it for free, if you are really dedicated to it.</p><p>Turning my pages back, I could say I am glad at what life presented me, even though I had a very rough start.</p><p>I’m not complaining about it right now, because that is the best thing to have happened to me, because it taught me how the world works, lead a simple life and make this world a beautiful place at a very early stage — to sum it up let’s say ‘<em>A Minimalist life</em>’.</p><p>So without boring you with a long story of my past life, let me sum it up in 4 lines.</p><p>I’m a UI developer by profession (Ember guy ;p). Love learning &amp; teaching in particular, because for me ‘Knowledge is something which is meant to be shared and not isolated’. Love to dance, staying with my single mom ( who is the most inspiring person, I could ever meet in my whole life) and I’m currently single ;P.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*PYKF3yoPhErtifPrml6oqQ.jpeg" /><figcaption>Friends are life.</figcaption></figure><p>Life brings a lot of interesting things on your way and the most wonderful thing which life introduces you to, is friendship. I think everyone would agree that anyone born in this world does not die without having a friend(s) that he could not remember. And I have met the soul friends, I have met friends who showed me the path, friends who bring abundant joy, who inspire me &amp; bring smile, and a friend (from a long way) who inspired me to be a software engineer. I would like to thank them for inspiring me, motivating me and making the person that I’m right now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-8-mWUXKqq6Fk3AfxGpA7w.jpeg" /><figcaption>Books for life</figcaption></figure><p>I love books. It is only thing which made me reborn and look at things in a way that would make me believe, that things will fall in place — the right place. It makes you forget the world around you — yeah, makes me forget the long waiting and terrible traffic in Bengaluru, Bengalureans please take this as a temporary solution and it is worth it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*ER0cxBp2rAGAQohuC_Bm1g.png" /><figcaption>Mentors to show the path of life</figcaption></figure><p>My mentor, he is by far more than a friend. Made me believe in myself. He always says and I quote ‘Things happen for a reason’. I can tell you, he made me believe, that problems in life are not so important anymore, and the terrible things that happened to me in my past, did happen for a reason — without which I would not have become a UI guy, meeting and working with awesome people around the world or writing my first blog like the one your reading. Such was his attitude and positive vibe, which brought the same attitude in me as well.</p><p>There is a saying in one of the books I read, that you need to mentor in your life. If you think that a person, is a mentor that you are looking for who would spend his time to give the life lessons that you need to make you a better person, than walk up straight to him and let him know, its as simple as that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*zfLwhzDNC115Ul-AT7J8aQ.jpeg" /><figcaption>Love is part of life (unexplored by me)</figcaption></figure><p>Love, it’s something that I am yet to explore, which told me, on many occasions, I was not ready for it yet. Eventually it will happen, but takes time. Because your not just meeting your mate, but a soulmate, who would spend rest of their life with you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9R14CjjceuaRm3FZMEruRg.jpeg" /><figcaption>Life always gives you presents</figcaption></figure><p>I think from my perspective ‘<strong><em>Life</em></strong>’ is like a Christmas tree, it always has presents under it, if you are doing the right thing and most importantly love what you are doing, but it tests you many at times and throws obstacles at you. If it is something that Life thinks is worth putting those very efforts that you have in getting that present, than damn right you give every effort that you have to get it. Sometimes you will not get it, than Life thinks its not suited for you and it has something bigger than this in store for you, so stop worrying about it, start thinking in a positive way and move on.</p><p>Finally, I thank everyone in my life who inspired me, motivated me, taught me and brought smile to my face, I owe them my whole life.</p><p>Until next time. Love your life, be kind and have courage and help one another. Live your life!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=916a1d0cb298" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>