<?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 Varun A P on Medium]]></title>
        <description><![CDATA[Stories by Varun A P on Medium]]></description>
        <link>https://medium.com/@apvarun?source=rss-47f3649e6154------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*omWMkmzGYlqp53kK_KxEdQ.jpeg</url>
            <title>Stories by Varun A P on Medium</title>
            <link>https://medium.com/@apvarun?source=rss-47f3649e6154------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:08:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@apvarun/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[You should start using Parcel Bundler ]]></title>
            <link>https://medium.com/hackernoon/you-should-start-using-parcel-bundler-c8606e0e98a9?source=rss-47f3649e6154------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8606e0e98a9</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[bundler]]></category>
            <category><![CDATA[parcel-js]]></category>
            <category><![CDATA[webpack]]></category>
            <dc:creator><![CDATA[Varun A P]]></dc:creator>
            <pubDate>Sun, 29 Jul 2018 03:25:14 GMT</pubDate>
            <atom:updated>2018-07-29T03:25:14.624Z</atom:updated>
            <content:encoded><![CDATA[<p>Parcel is module bundler that requires no initial configuration for to get it running. It is also dubbed as <strong>zero configuration web application bundler</strong> for the same reason, unlike Webpack which requires manual configuration.</p><blockquote><a href="https://parceljs.org/"><em>Parcel</em></a><em> is blazingly fast (as advertised) when it comes to compilation and bundling</em></blockquote><p>It also comes with features like support for a wide set of asset types, code splitting and hot module replacement for easier debugging. All these make it optimal and fast in execution.</p><h3>In case you are still wondering?</h3><h4>&gt; Bundling</h4><p>Bundling is a process of combining various types of resources/files that a project requires in an optimal way. It helps the browser to load the page faster, with lesser round trips to the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Rme6UlRERns7ZjgGv8hzQ.png" /></figure><h3>What makes Parcel worth the try?</h3><p>I’ve been working on a couple of React projects recently. All of the projects were using Webpack for packaging the app for production.</p><p>Every was working fine, until the time I included a large UI component library (Name?). After including the same for the build, Webpack build time increased drastically.</p><p>It took more that <strong>40 seconds</strong> for the build. You might think that it is fine and build is only for prod (mostly handled by CI). And yes it is! However, the actual problem was for the consecutive builds in dev mode.</p><p>Even with HMR enabled, the page started to take a toll. I would need to wait for like 10s for verifying the changes.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl4FGzF4Z2lKktzjHi%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Flego-lego-reactions-l4FGzF4Z2lKktzjHi&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fl4FGzF4Z2lKktzjHi%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/92fa60c03e5f75ae93fa6cd59ab47327/href">https://medium.com/media/92fa60c03e5f75ae93fa6cd59ab47327/href</a></iframe><p>This got me thinking!!! And it was the exact time I saw Devon Govett’s <a href="https://twitter.com/devongovett/status/1007291359336677377">tweet</a> about a new version of parcel. I decided to give it a try.</p><h3>Initial impressions?</h3><blockquote><em>This is so good! 😍</em></blockquote><p>Parcel does a lot of things for you that you don’t even need to think of any. You can focus on your code and getting the logic right, rather than dev environment setup.</p><p>Since it does the bundling based on files, the HMR was so effective that my concurrent dev builds took <strong>less than a second</strong> (usually around 400ms).</p><h3>Only bundling?</h3><p>Later on, I started exploring options to use it instead of task runners such as Gulp. Thanks to a couple of available plugins, I was able to set up live reload, compilation for markdown, and code linting.</p><p>Did I miss out to tell you that it also transpiles your ES6+ code using babel to ES5? Yeah, you heard it right.</p><p>Check out the full list of plugins and other awesome stuff available for Parcel here. <a href="https://github.com/parcel-bundler/awesome-parcel">Awesome Parcel Github Repo</a></p><p><strong>Did you know?</strong> Parcel can also bundle your Node apps by just setting the target as node in your npm scripts.</p><h3>What’s next</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*aINoW8ixA26Ou2NA.gif" /></figure><p>I would start using parcel for almost everything when I work on side projects. It will not replace Webpack completely as webpack ecosystem is much larger due to it’s long time existence.</p><p>I’ve also been working on some plugins for parcel that could help other developers at certain use cases.</p><blockquote>Try parcel for yourself, and you will start embracing it.</blockquote><p>I’m <strong>𝕍𝔸ℝ𝕌ℕ 𝔸 ℙ ⚡</strong> who lives and works in Bangalore, building useful things for everyone. <a href="https://twitter.com/apvarun">Follow me on Twitter</a></p><p><em>Originally published at </em><a href="https://apvarun.com/start-using-parcel-bundler/"><em>apvarun.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8606e0e98a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/you-should-start-using-parcel-bundler-c8606e0e98a9">You should start using Parcel Bundler 📦</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating to Webpack 4 today]]></title>
            <link>https://codeburst.io/migrating-to-webpack-4-today-d564b453a3ba?source=rss-47f3649e6154------2</link>
            <guid isPermaLink="false">https://medium.com/p/d564b453a3ba</guid>
            <category><![CDATA[webpack4]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[bundler]]></category>
            <category><![CDATA[code-splitting]]></category>
            <dc:creator><![CDATA[Varun A P]]></dc:creator>
            <pubDate>Sat, 24 Mar 2018 09:09:06 GMT</pubDate>
            <atom:updated>2018-03-28T13:52:24.455Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oJj7VCITmRw4VLRm_ud8Sw.png" /></figure><p>Today, I made a switch to Webpack 4 from version 3 for a project I am working on. And my first impression?<strong> Its definitely fast!</strong></p><p>The change brought down my build time from 13s to 7s, which is more than <strong>40% reduction</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2FUncomfortableHonoredAmericanwarmblood&amp;url=https%3A%2F%2Fgfycat.com%2Fgifs%2Fdetail%2FUncomfortableHonoredAmericanwarmblood&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FUncomfortableHonoredAmericanwarmblood-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="500" height="282" frameborder="0" scrolling="no"><a href="https://medium.com/media/34a78e781631e44ce8306fa3f1a9f89f/href">https://medium.com/media/34a78e781631e44ce8306fa3f1a9f89f/href</a></iframe><p>In the process, I did have some hiccups which I would be discussing below. Before getting to it, let me just go over the new additions to webpack in version 4 that actually matters.</p><p><strong>1. Speed</strong> — The entire webpack community has been drooling over this. Version 4 drastically reduces the build time for any kind of projects.</p><p>If you are already excited, don’t wait. Here is what you need to do.😁</p><pre>yarn add webpack webpack-cli --dev</pre><p><strong>2. Zero Configuration</strong> — Webpack now comes with defaults for entry and output, which helps in using the bundler with no config file.</p><p>The default entry point is <strong>./src/index.js</strong>. Create a file there and you are ready to go. The output files are emitted to <strong>./dist</strong>.</p><p><strong>3. Modes </strong>—Introduced to improve the default bundle outputs. There are two types of modes (development and production) which can be passed as props when running webpack.</p><blockquote>The development mode is optimized for build time where as the production mode optimizes the output bundles.</blockquote><p>The webpack 4 also has support for WebAssembly and Module Types</p><p>Without further due, here are the steps I followed for migration.</p><h3>Upgrading the version</h3><p>You need to upgrade the webpack version using the package manager of your choice.</p><pre>yarn add webpack webpack-cli --dev</pre><p>If you already have a lock file, you need to use <strong><em>yarn upgrade</em></strong><em> </em>to update the version.</p><p>In case you are wondering why webpack-cli package is required, v3 adds this package automatically. With version 4, the cli is a separate package which you can install manually. It is responsible for adding the command line support for webpack.</p><h3>Mode</h3><p>As I mentioned earlier, from version 4, it is necessary to specify the mode explicitly for running webpack. Otherwise you would end up with this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sSG5Rew_lLbdVALxJv73Ww.png" /></figure><p>Specify the mode as production or development for the scripts that run webpack in your package.json file.</p><p>Alternatively, you can specify the same in your webpack config file by setting the mode option.</p><pre>webpack --mode development <strong>/</strong> webpack --mode production</pre><p><strong><em>There is a ‘none’ mode as well just in case you don’t want to use the default configurations.</em></strong></p><h3>Plugins</h3><p>— The <strong>html-webpack-plugin</strong> that you are using(most probably) isn’t compatible with version 4.</p><p>The plugin developers have already added support and so you can pull in the same from NPM. The latest version at the time of writing this post (version 3.1.0) works like a charm.</p><p>— <strong>extract-text-webpack-plugin </strong>? Sorry to say, I was not able to get it to work with webpack 4.</p><p>Fortunately, there is <strong>mini-css-extract-plugin</strong> which is maintained by the Webpack team that can help you extract CSS to a separate file(s).</p><pre>yarn add -D mini-css-extract-plugin</pre><p>With these changes, I was able to spin up the development server and everything worked well.</p><p>Great. Let me check the production build. What could go wrong with it after all?</p><p>And then I get this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iwNBW_atJCvauSSvW2Sd6g.png" /></figure><p>🙄</p><p>The <strong>UglifyJsPlugin </strong>for production builds had to be moved from plugins to optimization in the config. Here is how I refactored it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*XX8FrHPb6DWPX1Vnpb02kg.png" /><figcaption>Using UglifyJs plugin with Webpack 4</figcaption></figure><h4>Quick note:</h4><p>In case you are using the <strong><em>CommonsChunkPlugin plugin</em></strong>, it has been deprecated. But, there is a built-in replacement in Webpack 4.</p><p>You can use the <strong><em>optimization.splitChunks</em></strong> API to generate shared chunks. And it is also enabled by default. It allows you to specify configurations if you have multiple end points in your application.</p><p>Yay, I was finally able to move my project to Webpack 4.🙌</p><h3>The future ?</h3><p>This release of webpack is just a step towards a much better and faster bundler. Things like multi-threading, persistent caching, HTML entry points etc <a href="https://twitter.com/TheLarkInn/status/965112759854641153">are coming</a> in version 5 of webpack.</p><p>What is in it for us? Just focus on your application logic ✌️ and let webpack sweat it.😉</p><figure><a href="http://bit.ly/codeburst"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3hPOj27LTt0ZPn5TQuhZg.png" /></a></figure><blockquote>✉️ <em>Subscribe to </em>CodeBurst’s<em> once-weekly </em><a href="http://bit.ly/codeburst-email"><strong><em>Email Blast</em></strong></a><strong><em>, </em></strong>🐦 <em>Follow </em>CodeBurst<em> on </em><a href="http://bit.ly/codeburst-twitter"><strong><em>Twitter</em></strong></a><em>, view </em>🗺️ <a href="http://bit.ly/2018-web-dev-roadmap"><strong><em>The 2018 Web Developer Roadmap</em></strong></a><em>, and </em>🕸️ <a href="http://bit.ly/learn-web-dev-codeburst"><strong><em>Learn Full Stack Web Development</em></strong></a><em>.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d564b453a3ba" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/migrating-to-webpack-4-today-d564b453a3ba">Migrating to Webpack 4 today</a> was originally published in <a href="https://codeburst.io/">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Firebase + React : Optimizing For The Real World]]></title>
            <link>https://codeburst.io/firebase-react-optimizing-for-the-real-world-4d9edbbd54c5?source=rss-47f3649e6154------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d9edbbd54c5</guid>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[cloud-functions]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[firebase]]></category>
            <dc:creator><![CDATA[Varun A P]]></dc:creator>
            <pubDate>Sun, 10 Sep 2017 08:46:52 GMT</pubDate>
            <atom:updated>2017-09-12T13:54:44.139Z</atom:updated>
            <content:encoded><![CDATA[<p>I started off to build a small web app that showcases the career paths of developers. As I love the approach React takes for the DOM, it was my only choice of framework.</p><p>For the data part, I decided to use Google’s Firebase. So the structure was simple. Retrieve the current data from Firebase and display it accordingly using React.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h-xRzZOCHk8jTlEa8M42GA.png" /></figure><p>I did achieve what I planned but then, something was just not right. The app’s bundle size was <strong>1.7MB</strong>.</p><p>Definitely not right for such a simple app that performs only GET.</p><p>And I decided to investigate. From inspecting the packages to finding better replacements, I was able to reduce my app size from <strong>1.7MB to just 230KB </strong>(<em>~135KB GZipped</em>).</p><p>Here is what I did.</p><h3>Switching to Preact</h3><blockquote><a href="https://preactjs.com/">Preact</a> is a fast 3kB alternative to React with the same ES6 API.</blockquote><p>I switched from using React to Preact as both are built using the same concept of virtual DOM. Since, preact is inspired by react, it is more optimal in using the DOM. It also has a smaller DOM abstraction layer, making the processing faster.</p><p>As I was using <strong>react-router</strong> to handle url routes, I had to add preact’s version of the routing component — <strong>preact-router</strong>.</p><p>If you are using any other react-dependent libraries, there is<strong> preact-compat</strong> for you. Preact-compat provides you the API mapping from react to preact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*AUVI8UddvYs-pIpWQ-p7-g.png" /></figure><p>This is my configuration. There is<strong> preact-motion</strong> for to add smooth transitions and animations as well.</p><h3>Using Bundle Analyser</h3><p>Webpack’s bundle analyser is a great tool to check which package consumes more space in your bundle.</p><p>Chris Bateman’s <a href="https://chrisbateman.github.io/webpack-visualizer/">Bundle visualizer</a> can help you view the webpack stats online.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*suUCxct0qIOWySnZf7BD7g.png" /></figure><p>Since I am using Firebase for the webapp, I was using their package installed via npm.</p><p>Know it or not, <strong>Firebase package comes at a huge cost</strong>. It contains interfaces for all the components that firebase offers, such as database, storage, cloud functions and more.</p><p>As I used only the database from firebase, I modified my import to add only the firebase-app (code) and firebase-database.</p><p>By this time, the bundle size reduced from 1.7MB to 1.1MB.</p><p>But that was definitely not enough. And that’s when I started looking at webpack configurations.</p><h3>WebPack Configuration</h3><p>I added the webpack uglify plugin to cut down on unwanted modules and dead code.</p><p>The <strong>webpack.optimize.UglifyJsPlugin </strong>did a pretty neat trick.</p><p>In addition to this, I also incorporated the compression plugin for to enable GZip compression for text files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*2CdlVfV1NWiENNtP3Yfq2w.png" /></figure><p>Even after all this, the bundle size was still at <strong>900KB</strong>.</p><p>Firebase was still occupying the major part of the bundle.</p><h3>Cloud Functions</h3><p>It was time I realized that I should drop firebase and go with something linear. But I was not able to find something better and as simple to use.</p><p>Meanwhile, I started to explore about cloud functions that firebase announced in Google IO 2017.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cnQ9z3c2LsR_HRCKrAq52w.png" /></figure><p>As it was coupled with other firebase services, I could get data from the realtime database and provide it as a rest API.</p><p>A simple node function did the trick.</p><p>I was able to get data from the <strong>realtime database via an API</strong>. I also added cache headers so that I don’t need to run the function on every request.</p><p>Response headers were also added to prevent the CORS issues.</p><p>Now, I could completely cut off firebase module from my bundle. I added superagent for faster AJAX calls.</p><p><strong><em>— The bundle size dropped drastically to less than 300KB.</em></strong></p><p>But there was one major issue that I had to take care of.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*owLzejf9Ron1ahjJjxAi8A.png" /><figcaption>First render time</figcaption></figure><p>This was completely insane considering that the entire page size along with data is only <strong>300KB</strong>.</p><h3>PureComponent</h3><p>PureComponent does shallow comparison to decide if the component has to be re-rendered or not. It ignores the changes inside props or state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/0*ddMH8PWupfklcnpN.gif" /></figure><p>I updated certain components to be pure as multiple renders were not required.</p><p>Luckily, PureComponent is also supported by Preact, with some help from preact-compat.</p><p>— <em>Yet, the data in the page took a long time to process and render.</em></p><h3>Network Logs</h3><p>I started examining all the individual steps performed before the data is rendered properly.</p><p>To my surprise, the API hosted with cloud functions was the cause.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*tda0rbzNBnUE_Ggy7V6xTQ.png" /><figcaption>Response from Cloud Function API</figcaption></figure><p>The response from the cloud function took<strong> 4.33 seconds for to receive the first byte</strong>. And it explained why the first meaningful paint was delayed.</p><p>After much reading, I found that cloud functions would be suspended if there was no activity for a period of time. So if I were to invoke the function once in a while (<em>like once in 6 hrs</em>), then every time it would take as much time to get the data.</p><p><strong><em>Side note:</em></strong><em> I think Cloud functions on Firebase is not production ready at this moment.</em></p><p>Finally, I ended up using the <a href="https://firebase.google.com/docs/reference/rest/database/"><strong>Firebase REST API</strong></a><strong> </strong>directly.</p><p>By this time, my bundle size has dropped a whooping <strong>92%</strong>, <strong>from 1.7MB to ~135KB GZipped</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*oUpuQ8-HugfkQLDZpMfJ_A.gif" /></figure><p>I was able to get some good scores with Lighthouse as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*S97ggBFOY0Cz27_KEMVtwg.png" /></figure><p>That’s it! 👍</p><p><em>🎉🎉🎉 </em><strong><em>If you like this post, please </em></strong>👏👏👏<em> </em><strong><em>on Medium and share it on Twitter.</em> <em>I would greatly appreciate it.</em></strong><em>🎉🎉🎉</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d9edbbd54c5" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/firebase-react-optimizing-for-the-real-world-4d9edbbd54c5">Firebase + React : Optimizing For The Real World</a> was originally published in <a href="https://codeburst.io/">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shape Shift Loader]]></title>
            <link>https://medium.com/@apvarun/shape-shift-loader-7b1f7b5f1cf5?source=rss-47f3649e6154------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b1f7b5f1cf5</guid>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[loader]]></category>
            <dc:creator><![CDATA[Varun A P]]></dc:creator>
            <pubDate>Wed, 07 Dec 2016 16:25:39 GMT</pubDate>
            <atom:updated>2016-12-07T16:27:52.035Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*VUJbaPjMZGwmPY_JkLnjww.jpeg" /></figure><p>There are numerous types of loading animations out there. From complex animations to simple rotating circles, they have become a part of the entire UI design process.</p><p>If simple is enough, head over <a href="https://jscriptme.com/experimenting-with-keyframes-css-3357b9e2af14">here</a> to find one with CSS. If not, continue.</p><h4>Demo:</h4><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fcodepen.io%2Fapvarun%2Ffull%2FJbvwWd%2F&amp;src=https%3A%2F%2Fcodepen.io%2Fapvarun%2Fembed%2Fpreview%2FJbvwWd%3Fheight%3D600%26amp%3Bslug-hash%3DJbvwWd%26amp%3Bdefault-tabs%3Dcss%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f62ac5c929fe1e8d93c59136e33ea73/href">https://medium.com/media/5f62ac5c929fe1e8d93c59136e33ea73/href</a></iframe><h4>How this works?</h4><p>I’m drawing a square initially. The width of the square is then extended to become a rectangle.</p><p>By using the border-radius property, and setting it to 50%, the shape then turns to be a circle. After which, transform is used to rotate the element.</p><p>Running the entire process in under 3s makes it a beautiful animation to be used on page load.</p><h4>Code?</h4><pre>animation: shifter 3s infinite;</pre><p>Here is the frames for the animation.</p><pre><a href="http://twitter.com/keyframes">@keyframes</a> shifter{<br>  0%{<br>    width: 100px;<br>    height:100px;<br>  }<br>  15%{<br>    width: 200px;<br>    height:50px;<br>  }<br>  30%{<br>    width: 100px;<br>    border-radius: 0%;<br>    height:100px;<br>  }<br>  45%{<br>    border-radius: 50%;<br>  }<br>  60%{<br>    border-radius: 0%;<br>    transform: rotate(0deg);<br>  }<br>  75%{<br>    transform: rotate(-135deg);<br>  }<br>  100%{<br>    transform: rotate(0deg);<br>  }<br>}</pre><p><strong>Color credits:</strong> <a href="https://flatuicolors.com/">Flat UI Colors</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b1f7b5f1cf5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pseudo Classes and Transforms // CSS]]></title>
            <link>https://medium.com/@apvarun/pseudo-classes-and-transforms-css-ed0dc764e8c?source=rss-47f3649e6154------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed0dc764e8c</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Varun A P]]></dc:creator>
            <pubDate>Fri, 25 Nov 2016 17:11:55 GMT</pubDate>
            <atom:updated>2016-11-25T17:11:55.646Z</atom:updated>
            <content:encoded><![CDATA[<p>Heard of pseudo classes in CSS? They are used as filters to the usual selectors offered by the good-old CSS.</p><p>According to W3, pseudo classes are used as follows.</p><pre>selector:pseudo-class {<br> property:value;<br>}</pre><p>So, if you have a list of elements, pseudo classes like first-child and list-child will hep to narrow down your selection to a particular one.</p><p>Another type of pseudo class include before, after, selection etc. Find the entire list at <a href="http://www.w3schools.com/Css/css_pseudo_classes.asp">W3</a>Schools.</p><p>Today, I will describe a small experiment to change the look of the checkbox. This is achieved by the use of before and after pseudo classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_7Gf_FdD3ZlRxC4T8FcOsw.png" /></figure><p>In order for a better UX, transform function of CSS is also coupled with the above.</p><p>Initially, let’s add a checkbox to the code.</p><pre>&lt;input type=”checkbox”&gt;</pre><p>To override the default view of a checkbox, the visibility of the check box is set as <em>hidden</em>.</p><p>I am going to convert a checkbox to a smiley made with a colon and a parenthesis. In the unchecked state, the smiley is sad and when checked, it smiles.</p><p>So, to achieve this, we need two characters(colon and parenthesis).</p><p>Colon is added in before pseudo class and parenthesis in after pseudo class. Don’t forget the set the content of before and after classes as visible or else it will inherit the property from the base checkbox class.</p><pre>input[type=checkbox]::before{<br> visibility:visible;<br> content:”:”;<br> display: inline-block;<br>}</pre><pre>input[type=checkbox]::after{<br> visibility:visible;<br> content:”(“;<br> display: inline-block;<br>}</pre><p>To handle the checkbox state change, the selector “checked” can be used.</p><pre>input[type=checkbox]:checked::after{<br> //code to change state<br>}</pre><p>When the element is clicked, the content can be changed from “(“ to “)”.</p><h3>Final touch:</h3><p>Every element that you see on the screen needs to be rotated for a better impression. To achieve that, CSS transform property comes to help.</p><pre>transform:rotate(90deg);</pre><p>Using the transform property on the base checkbox selector will make the entire item(including selector content) to rotate.</p><h3>View demo here:</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fapvarun%2Fembed%2Fpreview%2FMboXgL%3Fheight%3D600%26amp%3Bslug-hash%3DMboXgL%26amp%3Bdefault-tabs%3Dcss%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fapvarun%2Fpen%2FMboXgL%2F&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F893979.MboXgL.small.49776df5-8edf-4c02-9814-36b2fda58007.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf4d08e5616a040d9c2234538d2a8f28/href">https://medium.com/media/cf4d08e5616a040d9c2234538d2a8f28/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed0dc764e8c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ever wondered why we need to reset CSS?]]></title>
            <link>https://medium.com/@apvarun/use-of-resets-css-6059bbd130b5?source=rss-47f3649e6154------2</link>
            <guid isPermaLink="false">https://medium.com/p/6059bbd130b5</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Varun A P]]></dc:creator>
            <pubDate>Wed, 16 Nov 2016 17:25:00 GMT</pubDate>
            <atom:updated>2017-08-17T02:26:40.442Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Use of Resets // CSS</strong></h3><p>Ever heard of CSS resets? Well, they do exits. and they are actually useful when you start writing your own CSS from scratch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*pEkrlmp2DV4Sjeax.jpg" /></figure><p>As the name says, CSS Resets are used to reset the default CSS that your browser inserts. Various browsers display content differently without resets. I know what you might be thinking. In 2017? Yes, Microsoft Edge and Firefox do differ in certain aspects.</p><h4>No More Inconsistencies</h4><p>So, using resets will reduce inconsistencies with different browsers in things like default margins, line heights and font sizes, and so on.</p><p>There is a CSS reset created by <a href="http://meyerweb.com/eric/tools/css/reset/">Eric Meyer</a> that is still being used in many websites. It addresses the issues of a lot of commonly used HTML tags.</p><pre>/* http://meyerweb.com/eric/tools/css/reset/ <br>   v2.0 | 20110126<br>   License: none (public domain)<br>*/<br><br>html, body, div, span, applet, object, iframe,<br>h1, h2, h3, h4, h5, h6, p, blockquote, pre,<br>a, abbr, acronym, address, big, cite, code,<br>del, dfn, em, img, ins, kbd, q, s, samp,<br>small, strike, strong, sub, sup, tt, var,<br>b, u, i, center,<br>dl, dt, dd, ol, ul, li,<br>fieldset, form, label, legend,<br>table, caption, tbody, tfoot, thead, tr, th, td,<br>article, aside, canvas, details, embed, <br>figure, figcaption, footer, header, hgroup, <br>menu, nav, output, ruby, section, summary,<br>time, mark, audio, video {<br>	margin: 0;<br>	padding: 0;<br>	border: 0;<br>	font-size: 100%;<br>	font: inherit;<br>	vertical-align: baseline;<br>}<br>/* HTML5 display-role reset for older browsers */<br>article, aside, details, figcaption, figure, <br>footer, header, hgroup, menu, nav, section {<br>	display: block;<br>}<br>body {<br>	line-height: 1;<br>}<br>ol, ul {<br>	list-style: none;<br>}<br>blockquote, q {<br>	quotes: none;<br>}<br>blockquote:before, blockquote:after,<br>q:before, q:after {<br>	content: &#39;&#39;;<br>	content: none;<br>}<br>table {<br>	border-collapse: collapse;<br>	border-spacing: 0;<br>}</pre><p>Are you thinking that this is very long? Take a look at this.</p><pre>html, body, div, form, label { margin: 0; padding: 0; } h1, h2, h3, h4, h5, h6 { font-weight:normal; } img { border: 0; }</pre><p>This is the very minimal I could come up with. And since we use DIV based styling these days, we will not have to reset other tags.</p><p>If the above isn’t satisfying either, try this. * { margin:0; padding:0; }</p><p>Frameworks like Bootstrap and Foundation already incorporate such resets at the beginning of their code. Even small yet popular CSS framework <a href="http://bulma.io/">Bulma </a>(based on CSS flexbox) makes use of resets to avoid inconsistencies.</p><p>You can also use <a href="http://necolas.github.io/normalize.css/">Normalize CSS</a> by Nicolas Gallagher and Jonathan Neal to maintain the HTML5 standards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6059bbd130b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Experimenting With Keyframes // CSS]]></title>
            <link>https://medium.com/@apvarun/experimenting-with-keyframes-css-3357b9e2af14?source=rss-47f3649e6154------2</link>
            <guid isPermaLink="false">https://medium.com/p/3357b9e2af14</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Varun A P]]></dc:creator>
            <pubDate>Sat, 12 Nov 2016 04:11:33 GMT</pubDate>
            <atom:updated>2016-11-19T17:36:41.802Z</atom:updated>
            <content:encoded><![CDATA[<p>Experimenting With Keyframes // CSS</p><p>CSS3 was born with lots of advanced stuff. And definitely, Keyframe animations were one that requires attention.</p><p>Yea, I remember hearing keyframes back in my school days when I first got to work with Macromedia Flash. And now in 2016, the concept is the same. Only thing is that it’s more efficient.</p><p>And CSS animations do use hardware acceleration in most browsers(forget IE as usual).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*PiDshQ3nqlh33_Mb.png" /></figure><h4>Sample Code</h4><p>I wrote a few lines of code to create a page loading animation that can replace a javascript call.</p><p>&lt;div&gt;&lt;/div&gt;</p><p>It uses only one DIV to host the animation. And the style for it goes as follows.</p><pre>div{ position:absolute; top:50%; left:50%; width:50px; height:50px; border:2px solid #00b2eb; border-radius:50%; animation:spinner 1s infinite; }</pre><p>Here, the position-related attributes are for centering the animation in the page. This can be changed as your requirement because sometimes we might have to show certain animations below webforms, links etc.</p><blockquote><em>The border and the animation are the ones that actually perform the trick.</em></blockquote><p>Giving a border to the div draws a square. This is because the width and height are same.</p><p>And the border-radius:50% makes the edges curves and forms a circle for the loader.</p><p>After this is done, we would have a static circle on the screen. To add the animation, we replace border:2px solid #00b2eb; with border-top:2px solid #00b2eb; so that only one quarter of the circle has the border.</p><p>Now, it’s time for the keyframe definition.</p><pre>@keyframes spinner{ 0%{transform:rotate(0deg);} 100%{transform:rotate(360deg);} }</pre><p>What this basically means is that, at the start of the animation(0%) the rotation should be 0deg and at the end(100%), it should be 360deg.</p><p>CSS automatically takes values for intermediate positions like 50% as 180deg, leading to a smooth animation.</p><h4>Demo</h4><p>See the Pen <a href="http://codepen.io/apvarun/pen/ObyyjL/">Minimal CSS Loader</a> by Varun A P (<a href="http://codepen.io/apvarun">@apvarun</a>) on <a href="http://codepen.io/">CodePen</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3357b9e2af14" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>