<?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 KK on Medium]]></title>
        <description><![CDATA[Stories by KK on Medium]]></description>
        <link>https://medium.com/@krishnakiran1992?source=rss-da202a6e8627------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*saG9IEiFsZHO8epvby_ktQ.jpeg</url>
            <title>Stories by KK on Medium</title>
            <link>https://medium.com/@krishnakiran1992?source=rss-da202a6e8627------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 17:35:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@krishnakiran1992/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[Pixel-perfect Web implementation]]></title>
            <link>https://medium.com/@krishnakiran1992/pixel-perfect-web-implementation-5598a10bc761?source=rss-da202a6e8627------2</link>
            <guid isPermaLink="false">https://medium.com/p/5598a10bc761</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[pixel-perfect]]></category>
            <category><![CDATA[ux-design]]></category>
            <dc:creator><![CDATA[KK]]></dc:creator>
            <pubDate>Thu, 07 Mar 2024 06:15:58 GMT</pubDate>
            <atom:updated>2024-08-21T13:00:29.464Z</atom:updated>
            <content:encoded><![CDATA[<h4>Why my developed web page isn’t matching the Design</h4><blockquote>A well-crafted webpage is crucial for accurately portraying a brand’s visual identity and messaging. Implementing pixel-perfect design guarantees consistency, reinforcing brand recognition and enhancing overall brand perception.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qp354AyxD33Rrd8tj0YitA.png" /></figure><h3>What is pixel perfect web design or implementation</h3><p>Pixel-perfect implementation means making sure a website is built exactly as per the design plans, to the smallest detail. It implies precision and accuracy in translating the visual design into the actual web development, ensuring that the final product closely resembles the original design intent. This level of attention to detail is often crucial for maintaining a consistent and polished user experience.</p><h3>My webpage is looking different from the design</h3><p>Web developers, even experienced ones, struggle to match design specifications. Precision in creating webpages aligned with the design’s vision demands attention to detail and skill. Insufficient expertise, inconsistent design elements, time constraints, and technical/browser limitations often lead to discrepancies between web pages and designs. Let’s delve into a closer examination of some of these reasons.</p><h4><strong>Lack of Attention to detail &amp; inadequate knowledge of Design tools</strong></h4><p>Paying close attention to minute visual details is essential for specific design elements. This involves meticulous consideration of factors like spacing, alignment, font sizes, gradients, shadows, and the overall visual coherence. For instance, a developer could easily overlook a border on a card that also features a shadow, or vice versa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AE7YFq3OyEykNfM8NH1sJQ.png" /><figcaption>Implementation misses minute visual details — Tag spacing &amp; missing border</figcaption></figure><p>Developers might unintentionally make spacing and alignment errors or overlook small animations and interactions in the design. Difficulty using design tools like Photoshop, Sketch, Figma, or Adobe XD can pose challenges when translating design files into accurate code.</p><h4>Time &amp; Resource Constraints</h4><p>Tight project deadlines can create challenges for developers aiming to achieve pixel-perfect development. With limited time, developers tend to prioritise speed over attention to detail, leading to potential compromises in the quality of the implementation.</p><p>With limited resources, there also comes an urgency in finishing the functional/logical aspect of the application forcing the visual detail to take a back seat.</p><h4>Browser Compatibility</h4><p>Different web browsers may render web pages slightly differently due to variations in their rendering engines and support for certain CSS or HTML features. Native browser elements like scroll bars, form elements (Drop-downs, Radio buttons , checkboxes) look different across various browsers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1tds3wj0qxB27EZlUUFjww.png" /><figcaption>Font rendering differences on Mac &amp; Windows</figcaption></figure><p>Certain CSS properties are not compatible in few browsers and might need vendor prefixes. Fonts, especially custom ones and those using non-standard rendering engines, might display differently across browsers, affecting the overall typography and design.</p><h4><strong>Responsive design challenges and Device diversity</strong></h4><p>Variations in devices, screen sizes, and platforms can impact the way a design is implemented. Ensuring pixel perfection becomes more complex when designing for responsive layouts. Elements may need to adapt to various screen sizes, leading to compromises in achieving pixel-perfect results</p><p>Designers may not always account for the differences in screen sizes, leading to inconsistencies in the user experience across various devices.</p><h4>Skill Gaps &amp; Technical limitations</h4><p>Developers may lack the necessary skills or expertise to implement certain complex design elements as envisioned by the UX designers. Sometimes, the technologies and tools available for development may have limitations that prevent the exact replication of certain design features.</p><p>Certain advanced animations supported by the design tools are very difficult to re-create using HTML/CSS and require the use of custom 3rd party libraries that might have a steep learning curve and make the webpage unnecessarily heavy.</p><p>In some situations, a design element may have technical difficulties due to constraints related to data loading and application performance. For instance, consider a carousel displaying data for various products on each slide. Since each slide requires fetching data on demand, there might be a delay in rendering, resulting in a less-than-smooth transition between slides.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*tNBiXfgCF_87LDkeHnPUzQ.gif" /></figure><h4>Dynamic, Scaling Content &amp; Media</h4><p>Designs typically come with static or limited content, which may not account for the dynamic nature of webpages. The content can be so dynamic that it may not fit neatly within the designated elements. In cases where content varies, developers may struggle as element sizes change, affecting the overall visual appeal of the page.</p><p>Media elements like images and videos bring about challenges in rendering for different resolutions, aspect ratios, and cropping behaviours. Key brand content, such as banner images/videos, may look distorted due to the technical complexities involved in managing aspect ratios and dynamic cropping to display the intended graphic accurately.</p><h4>Communication Gap &amp; Misinterpretation of Design</h4><p>Lack of effective communication between UX designers and developers can lead to misunderstandings. If the designers’ intentions and ideas are not clearly conveyed, Developers might interpret the design differently from what was intended. This can be due to differences in perspectives, experience, or individual interpretations of design specification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*-rY0j1_yNo_4WiWGO1KHvw.png" /></figure><h4><strong>Not everything is specified in Design/ Design gaps</strong></h4><p>Aligning element sizes with design specifications can be challenging for developers. This issue commonly arises when overlooked properties such as line-height and letter-spacing differ in the implementation. Mismatches may also occur when there are gaps in the design, and not all properties contributing to the element’s size are specified by the designer.</p><h4>Design System Constraints &amp; Inconsistent Designs</h4><p>A lot of design systems/ component libraries(MUI, Carbon) that speed up development come with a standard set of rules for theme — colours, typography, spacings which are applied to elements/components based on the configuration for theme.</p><p>For example in MUI, defining shades (main, light, dark, contrastText) for colours like primary, secondary, error, success, warning, and info allows the theme to apply background and contrasting text colours to various elements. Inconsistent designs, whether intentional or not, pose challenges for developers.</p><p>Designers sometimes use inconsistent spacings and typography(font sizes, weights) across various pages for visual appeal that may not adhere to the theme, leading to implementation gaps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AKen6qVw7M33chFTfDvYjA.png" /></figure><p>Matching web implementation with design enhances user satisfaction and ensures the website’s functionality and usability on various platforms. Developers encounter numerous challenges in realising the vision set by the Brand/Designer, as discussed earlier.</p><blockquote>UX designers grapple with their own set of formidable challenges, as detailed in <a href="https://medium.com/@rohitarunrao/what-i-see-is-not-what-i-get-2ebc514138d0">What I see is not what I get!</a> by <a href="https://medium.com/u/9ec969b262d4">Rohit UXD</a> — A must read</blockquote><blockquote>In the ever-evolving landscape of web development, recognising the constraints and overcoming the challenges outlined serve as a foundation for delivering a more cohesive online experience that reinforces brand identity</blockquote><p>In an era of ever-changing web standards and a growing emphasis on maintaining brand identity for relevance, developers face a rising challenge in aligning with the brand’s vision. However, by fostering effective collaboration, continuous learning, and a keen understanding of design principles, we can strive to bridge the gap between design vision and web implementation. More on this for later.</p><p>I appreciate you taking the time to read this article. Please leave a comment regarding how you found it.</p><p>Cheers,<br>-KK</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5598a10bc761" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Module Federation for Micro frontends]]></title>
            <link>https://medium.com/@krishnakiran1992/module-federation-for-micro-frontends-8ef1b024d248?source=rss-da202a6e8627------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ef1b024d248</guid>
            <category><![CDATA[module-federation]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[micro-frontends]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[KK]]></dc:creator>
            <pubDate>Mon, 13 Feb 2023 05:52:15 GMT</pubDate>
            <atom:updated>2023-02-13T05:52:15.285Z</atom:updated>
            <content:encoded><![CDATA[<p>Build large scale web applications using micro front ends and run time composition</p><blockquote>Web applications have become huge, and managing monolithic front-end applications has become increasingly challenging. A split into smaller “micro-apps” allows independent teams to work separately, making large projects easier to manage.</blockquote><figure><img alt="Cover picture | Webpack + Module Federation" src="https://cdn-images-1.medium.com/max/1024/0*wpow2OiYiiNlVGLw" /></figure><h3>What is a Micro front end</h3><p>Micro-frontends breaks down a traditional monolithic frontend into smaller, independent web applications. Deployed and run in a distributed manner, micro-frontends offer a flexible and scalable solution that combines the advantages of monolithic and micro-services architectures.</p><p>With micro-frontends, frontend development becomes more focused and modular. Each micro-frontend addresses a specific concern and is managed by a dedicated, cross-functional team, leading to increased agility, faster release cycles, and improved scalability.</p><p>There are several ways to combine micro-frontends into a single user interface, including using iframes, server-side composition, and client-side composition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*g0bUnqAap5K8llQLJSidUQ.jpeg" /><figcaption>How micro front end breaks down traditional monoliths</figcaption></figure><h3>Module Federation</h3><p>Module Federation is a feature in Webpack that allows the sharing of code and dependencies between separate application codebases. Applications can dynamically run code from another bundle or build with its code sharing capabilities, enabling successful composition of micro-frontends.</p><p>Module federation allows dependency sharing — An application consuming a federated module will download its dependencies from the federated build origin, but will attempt to use the consumers’ dependencies before downloading more payload.</p><p>Let’s look at some terminology associated with module federation — <strong><br></strong><em>“As written by Zack Jackson — creator of Module Federation in his </em><a href="https://indepth.dev/posts/1173/webpack-5-module-federation-a-game-changer-in-javascript-architecture"><em>blog</em></a><em>”</em></p><ul><li><strong>A host</strong>: A Webpack build that is initialised first during a page load (when the onLoad event is triggered)</li><li><strong>A remote</strong>: another Webpack build, where part of it is being consumed by a “<strong>host</strong>”</li><li><strong>Bidirectional-hosts</strong>: when a bundle or Webpack build can work as a host or as a remote. Either consuming other applications or being consumed by others — at runtime</li></ul><h3>Module Federation in action</h3><pre>plugins: [<br>  new ModuleFederationPlugin({<br>    name: &quot;MFE&quot;,<br>    filename: &quot;remoteEntry.js&quot;,<br>    exposes: {},<br>    remotes: {},<br>    shared: [],<br>    library: &quot;var&quot;,<br>  })<br>]</pre><h4><strong>Configuration</strong></h4><ul><li><strong>name</strong>: Unique identifier that identifies the exposed container</li><li><strong>filename</strong>: The name for the output bundle that also serves as an entry point</li><li><strong>exposes: </strong>Path to the module or files exposed by the container; it can be an object or an array.</li><li><strong>remotes: </strong>A<strong> </strong>list of static remote modules that can be accessed by the host</li><li><strong>shared: </strong>A list of dependencies that the exposed modules depend on. Core libraries that are used across, helps to avoid code duplication. <br>[Eg. <strong>react</strong>, <strong>react-dom</strong>]</li><li><strong>library:</strong> specifies how the exposed code will be stored and retrieved.</li></ul><p>A detailed list of all the configuration options can be found <a href="https://gist.github.com/zfeher/201f55c057553078fe5b0aac1dad6969">here</a>.</p><p>Let’s build a sample application - composed of three applications a host, a remote and a bi-directional host to better understand ModuleFederation.</p><figure><img alt="Sample project’s micro front end outlines — directional representation" src="https://cdn-images-1.medium.com/max/1024/1*C0sXgRR8Pq-EKZ97L2zrsw.png" /><figcaption>Module federated application outline</figcaption></figure><p>The remote application (<strong>mf-components</strong>) serves as a component library, where reusable components are developed.</p><p>The bi-directional application (<strong>mf-bidi</strong>) leverages components from <strong>mf-components</strong> to construct its user interface.</p><p>The host application (<strong>mf-host</strong>) integrates <strong>mf-bidi</strong> and renders the exposed components.</p><h4><strong>Setup</strong> the Development Environment</h4><p>Follow the instructions in the article to create three separate apps — <strong>mf-components</strong>, <strong>mf-host</strong> and <strong>mf-bidi</strong>. You can alternatively use this <a href="https://github.com/kk-stack/react-starter-template/generate"><strong>template</strong></a> to setup your code.</p><p><a href="https://medium.com/@krishnakiran1992/react-starter-template-ecb2914a09fc">React Starter Template</a></p><p>It’s important to note that each of the three apps should run on a unique port (can be changed in the ‘webpack.config.js’ file). For this sample application, let’s run <strong>mf-host</strong> on 9000, <strong>mf-bidi</strong> on 9001 and <strong>mf-components</strong> on 9002</p><h4>Building the App</h4><p>I’ve provided step-by-step instructions to make sure they are clear and easy to follow. Experienced developers might find these instructions repetitive. If you prefer to quickly review the final code or need to refer to it during the process, you can find it <a href="https://github.com/kk-stack/mf-sample">here</a></p><p><strong>mf-components app<br></strong>Create a Button and a Card component in <strong>mf-components. </strong>Add Button.js and Card.js in the /src folder</p><pre>//Card.js<br>import styled from &quot;styled-components&quot;;<br><br>const Card = styled.div`<br>    padding: 0 1em 1em;<br>    background: #F4F0F0;<br>    border: 1px solid #757575;<br>    max-width: 300px;<br>    margin-top: 20px;<br>    border-radius: 6px;<br>    box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;<br>`<br>export default Card;<br><br>//Button.js<br>import React from &#39;react&#39;;<br>import styled from &#39;styled-components&#39;;<br><br>const StyledButton = styled.button`<br>    padding: 8px 12px;<br>    background: ${props =&gt; props.primary ? &#39;#1338BE&#39; : &#39;transparent&#39;};<br>    outline: none;<br>    border: 1px solid #1338BE;<br>    color: ${props =&gt; props.primary ? &#39;white&#39; : &#39;inherit&#39;};<br><br>`;<br><br>const Button = (props) =&gt; &lt;StyledButton {...props}&gt;&lt;/StyledButton&gt;<br><br>export default Button;</pre><p>Now, we can make these components accessible through Module Federation so that the <strong>mf-bidi</strong> app can consume them. Let’s add the ModuleFederationPlugin to the Webpack configuration.</p><pre><br>const ModuleFederationPlugin = require(&#39;webpack&#39;).container.ModuleFederationPlugin;<br><br>plugins: [<br>    new HtmlWebpackPlugin({<br>      template: &quot;src/index.html&quot;,<br>    }),<br>    // Add the below to the webpack config file<br>    new ModuleFederationPlugin({<br>      name: &quot;MFComponents&quot;, // FederatedModuleName-will be referred by the consuming app<br>      filename: &quot;remoteEntry.js&quot;, //entry file for the exposed bundle<br>      exposes: {<br>        &#39;./Button&#39;: &#39;./src/Button&#39;, //Indivdual exposed components <br>        &#39;./Card&#39;: &#39;./src/Card&#39;<br>      },<br>      remotes: {},<br>      shared: {<br>        &#39;react&#39;: {<br>          singleton: true,<br>          requiredVersion: &quot;^18.2.0&quot;<br>        },<br>        &#39;react-dom&#39;: {<br>          singleton: true,<br>          requiredVersion: &quot;^18.2.0&quot;<br>        },<br>        &#39;styled-components&#39;: {<br>          singleton: true,<br>          requiredVersion: &quot;^5.3.6&quot;<br>        }<br>      }<br>    })<br>  ],</pre><p>Restart the server to check if our <strong>mf-components</strong> is still working as expected. We will now be seeing the error below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0LmjocSmztH7jHRnGihOgQ.png" /></figure><p>To resolve this <a href="https://webpack.js.org/concepts/module-federation/#uncaught-error-shared-module-is-not-available-for-eager-consumption">error</a> , create an asynchronous boundary by using an import function in our entry file.</p><p>Rename the current index.js to bootstrap.js and create a new index.js file</p><pre>import(&quot;./bootstrap&quot;);</pre><p>With this import we are asynchronously loading dependencies, thus reducing the size of the entry file.</p><p>In the configuration file, while defining shared modules, we have passed the below options:<br>- <strong>singleton</strong>: Used to force webpack to load only one copy of the dependency when applications have different versions of the same. By default, Webpack loads a single copy of shared dependencies if their versions are compatible<br>- <strong>requiredVersion: </strong>Specifies the version of the dependency needed for the application</p><p><strong>mf-bidi app</strong></p><p>We will now include the Module Federation plugin in the <strong>mf-bidi</strong> app. The configuration will be similar to what we previously had, but with the addition of consuming the <strong>mf-components</strong> through the ‘remotes’ configuration value.</p><pre><br>const ModuleFederationPlugin = require(&#39;webpack&#39;).container.ModuleFederationPlugin;<br><br>plugins: [<br>    new HtmlWebpackPlugin({<br>      template: &quot;src/index.html&quot;,<br>    }),<br><br>    new ModuleFederationPlugin({<br>      name: &quot;MFBiDi&quot;, // FederatedModuleName<br>      filename: &quot;remoteEntry.js&quot;,<br>      exposes: {}, // We are currently not exposing anything yet<br>      remotes: {<br>        MFComponents: &#39;MFComponents@http://localhost:9002/remoteEntry.js&#39;,<br>      },<br>      shared: {<br>        &#39;react&#39;: {<br>          singleton: true,<br>        },<br>        &#39;react-dom&#39;: {<br>          singleton: true,<br>          requiredVersion: &quot;^18.2.0&quot;<br>        },<br>        &#39;styled-components&#39;: {<br>          singleton: true<br>        }<br>      }<br>    })<br>  ],</pre><p>In the remotes configuration, a key-value pair is defined. The key is used to reference the exposed modules from <strong>mf-components</strong>, and the value refers to the name of the federated module and its location. The syntax can be explained as:</p><p><strong>“</strong><strong>ReferenceName: FederatedModuleName@location of entry file exposed”</strong></p><p>The <strong>ReferenceName</strong> can be given any convenient name, but the <strong>FederatedModuleName</strong> must match the name of the federated module being consumed.</p><p>We can now import components from <strong>mf-components</strong> as shown</p><pre>//App.js<br><br>import React from &quot;react&quot;;<br>import Button from &quot;MFComponents/Button&quot;;<br>import Card from &quot;MFComponents/Card&quot;;<br><br>const App = () =&gt; {<br>  return (<br>    &lt;&gt;<br>      &lt;Card&gt;<br>        &lt;h3&gt;Bi directional app&lt;/h3&gt;<br>        &lt;p&gt;This app imports Card and Button from mf-components&lt;/p&gt;<br>        &lt;Button primary&gt;Card Button&lt;/Button&gt;<br>      &lt;/Card&gt;<br>    &lt;/&gt;<br>  );<br>};<br><br>export default App;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IYdKwNhPLwHfuHvhvIRb1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KgsnjQMBS0SznjNOlPV7tA.png" /><figcaption>Visualise <strong>mf-bidi</strong> app | Loads components from <strong>mf-components</strong> app</figcaption></figure><p><strong>Observations from the image above:</strong></p><ol><li>Button and Card are being loaded from 9002 port on the local server.</li><li>Dependencies (vendors-node_modules) are being loaded only once and shared for both apps.</li></ol><p>Expose App.js to make our app <em>bi-directional</em> and create an asynchronous boundary as earlier.</p><pre>new ModuleFederationPlugin({<br>  ...<br>  exposes: {<br>    &#39;./App&#39; : &#39;./src/App&#39;<br>  },<br>})</pre><p><strong>mf-host app</strong></p><p>Add ModuleFederation plugin to the host app, to consume <strong>mf-bidi</strong></p><pre><br>  plugins: [<br>    new HtmlWebpackPlugin({<br>      template: &quot;src/index.html&quot;,<br>    }),<br>    new ModuleFederationPlugin({<br>      name: &quot;MFHost&quot;,<br>      filename: &quot;remoteEntry.js&quot;,<br>      exposes: {}, // This is our host and we need not expose anything<br>      remotes: {<br>        MFBiDi: &#39;MFBiDi@http://localhost:9001/remoteEntry.js&#39;,<br>      },<br>      shared: {<br>        &#39;react&#39;: {<br>          singleton: true,<br>        },<br>        &#39;react-dom&#39;: {<br>          singleton: true,<br>          requiredVersion: &quot;^18.2.0&quot;<br>        },<br>        &#39;styled-components&#39;: {<br>          singleton: true<br>        }<br>      }<br>    })<br>  ],</pre><p>Import MFBiDi App into ‘App.js’</p><pre>import React from &quot;react&quot;;<br>import {default as BiDiApp} from &#39;MFBiDi/App&#39;;<br><br>const App = () =&gt; {<br>  return (<br>    &lt;&gt;<br>      &lt;h1&gt;MF Host&lt;/h1&gt;<br>      &lt;hr /&gt; {/* We are adding a hr to clearly separate Host and BiDi app */}<br>      &lt;BiDiApp /&gt;<br>    &lt;/&gt;<br>  );<br>};<br><br>export default App;</pre><p><strong>&quot;Do create an asynchronous boundary using import as previously done&quot;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nY8R1cDiN-xxX_j5DBb80g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RxfgegwjOQbiUb3Xx2R5JA.png" /><figcaption>Visualise <strong>mf-host</strong> app | Loads App from <strong>mf-bidi</strong> app which loads components from <strong>mf-components</strong> app</figcaption></figure><p><strong>Observations from the image above:</strong></p><ol><li><strong>mf-bidi</strong> App is loaded from port 9001 and rendered in the host app</li><li>react-dom and react dependencies are loaded from host while the styled-components dependencies are loaded from port 9002. This is because styled-components are imported only in <strong>mf-components</strong> app</li></ol><blockquote>We have seen how ModuleFederationPlugin facilitates the exposure and consumption of modules to construct a cohesive web application</blockquote><h3>Additional Reading</h3><p>Let’s improve upon few things from the sample application</p><ol><li><strong>Dependency sharing:</strong> We can pass dependencies from package.json into Webpack configuration, so that we need not keep adding dependencies each time we add one to the project.</li></ol><pre>const { dependencies } = require(&#39;./package.json&#39;);<br><br>new ModuleFederationPlugin({<br>    ...,<br>    shared: {<br>      ...dependencies,<br>    }<br>})</pre><p>2. <strong>Lazy loading modules: </strong>Module Federation supports lazy loading bundles to load modules only when necessary, resulting in better web performance. Let’s modify our <strong>mf-host</strong> app to lazily load <strong>mf-bidi</strong> modules</p><pre>//App.js<br><br>import React, {Suspense, lazy, useState} from &quot;react&quot;;<br><br>const App = () =&gt; {<br>  const [loadBiDi, setLoadBiDi] = useState(false);<br>  const BiDiApp = lazy(() =&gt; import(&#39;MFBiDi/App&#39;));<br>  return (<br>    &lt;&gt;<br>      &lt;h1&gt;MF Host&lt;/h1&gt;<br>      &lt;hr /&gt;{/* We are adding a hr to clearly separate Host and BiDi app */}<br>      {<br>        loadBiDi ? <br>          &lt;Suspense fallback={&lt;p&gt;loading&lt;/p&gt;}&gt;&lt;BiDiApp /&gt;&lt;/Suspense&gt; : <br>          &lt;button onClick={() =&gt; setLoadBiDi(true)}&gt;Load Bi Di App&lt;/button&gt;<br>      }<br>    &lt;/&gt;<br>  );<br>};<br><br>export default App;</pre><p>Move the import from the top of the file into React’s lazy implementation. Wrap the component returned by lazy inside &lt;Suspense /&gt; and use a button to load the component on demand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ogFXme7sxnn88Gz8Tw2FvA.gif" /><figcaption>Lazy load <strong>mf-bidi</strong> on demand</figcaption></figure><p><strong>Observations from the image above:</strong></p><ol><li>Initially, only the entry-file for the exposed module is loaded from <strong>mf-bidi</strong> app.</li><li>Webpack loads the modules &amp; dependencies from <strong>mf-bidi</strong> app on demand(user clicks the button).</li><li>All modules &amp; dependencies for <strong>mf-components</strong> are loaded along with <strong>mf-bidi</strong> app as per need.</li></ol><h3>Conclusion</h3><p>Webpack Module Federation is scaleable, performant and easy to configure for existing applications with minor modifications making it a very good candidate to compose micro front ends. Users/applications seeking a flexible and framework-agnostic solution can take a look at <a href="https://www.npmjs.com/package/@softarc/native-federation">native-federation</a> which creates a browser-native solution that can be paired with any build tool.</p><p>I appreciate you taking the time to read this article. Please leave a comment regarding how you found it.</p><p>Cheers,<br>-KK</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ef1b024d248" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Right to left styling for the Web]]></title>
            <link>https://medium.com/@krishnakiran1992/right-to-left-styling-for-web-apps-b4573d8979db?source=rss-da202a6e8627------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4573d8979db</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[right-to-left]]></category>
            <category><![CDATA[styling]]></category>
            <dc:creator><![CDATA[KK]]></dc:creator>
            <pubDate>Mon, 26 Sep 2022 13:45:10 GMT</pubDate>
            <atom:updated>2022-10-04T11:29:32.412Z</atom:updated>
            <content:encoded><![CDATA[<h4>An understanding of how to handle right to left text in HTML</h4><blockquote>Developing and authoring a right-to-left(RTL) website is an unconventional task, even for an experienced frontend developer. With growing market demand it has become essential for developers to understand what it takes to develop RTL-compatible websites</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/0*z_ptP2M84t91dVBP.jpg" /></figure><h3>Why RTL?</h3><p>There are a few languages in the world (Arabic, Hebrew, etc.) that read their texts right-to-left rather than left-to-right. Adding RTL support for your website is simple and can greatly increase its market. In order to cater to RTL languages, developers must adapt their development process in particular ways.</p><h3>How to support RTL</h3><p>In Web applications supporting RTL languages, everything is reversed or flipped, including text, scroll bars, progress indicators, buttons etc. Let’s look at some development guidelines to support RTL.</p><h4><strong>Add dir and lang to HTML</strong></h4><ol><li>Add dir=&quot;rtl&quot; on the &lt;html&gt; element. The browser interprets the dir tag and automatically flips and renders the content of the website.</li><li>Add an appropriate lang attribute, like lang=&quot;ar&quot;, on the &lt;html&gt; element. The lang global attribute <strong>helps define the language of an element</strong>: the language that non-editable elements are written in, or the language that the editable elements should be written in by the user</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NAvJLzwbSVPwsNJ5mFeq6g.png" /><figcaption>Content rendered in LTR and RTL</figcaption></figure><h4><strong>Adjust CSS to support RTL rendering</strong></h4><p>Having learned that the browser interprets the direction tag, let’s see how it interprets CSS. Let’s take an example of a card which contains an image and text adjacent to each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*UO_Yl4sedAG72YVCt_xmPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*HVZsNuKMwIyIK9YIssRwDA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*7V1mRejm2LuggI4SXNAGaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Evsx_3-bb5S8d2-nIpavSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AsY0PNhnEW7X-gDaulReiQ.png" /><figcaption>Card rendered in both directions</figcaption></figure><p>We can see that the card on the right has text right to left rendered, but the margin and the image are not interpreted right-to-left. In order to support RTL, our CSS needs to be modified.</p><p><strong>Modifying directional property values<br></strong>Floating the image to the right and applying margin to its left will fix the rendering.</p><pre>.media img {<br>    float: right;<br>    margin-left: 20px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b1qFzh0SDE5kd9URnuJA4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*lwygYTQRU2_vhjE5NKDHAw.png" /><figcaption><em>Using dir</em> attribute to override CSS for both RTL and LTR applications</figcaption></figure><p>This approach is straightforward, and easy to understand but also increases the amount of CSS we need to write. Let’s take a look at alternate approaches…</p><p><strong>Use logical CSS properties<br></strong>It is possible to automatically align our content right-to-left, without the hassle of writing additional CSS. Use ‘logical properties’ like ‘start’ and ‘end’, rather than ‘left’ or ‘right’.</p><blockquote>Using logical properties by default makes it easier to localise content or include text with a different direction.</blockquote><p>Modify our code to remove float on the image and add margin-right via margin-inline-end.</p><pre>.media {<br>    display: flex;<br>}</pre><pre>.media img {<br>    margin-inline-end: 20px;<br>}</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fkk_92%2Fembed%2Fpreview%2FvYjegmP%3Fdefault-tabs%3Dhtml%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DvYjegmP&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fkk_92%2Fpen%2FvYjegmP&amp;image=https%3A%2F%2Fshots.codepen.io%2Fkk_92%2Fpen%2FvYjegmP-512.jpg%3Fversion%3D1663913014&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a57ffa42c9d1b952aa3375045993da5/href">https://medium.com/media/0a57ffa42c9d1b952aa3375045993da5/href</a></iframe><p><strong>Create multiple stylesheets<br></strong>Sometimes, logical properties do not yield the desired results — in such cases, we must rely on overriding property values with the dir attribute. This will bulk up the CSS and we might want to optimise it by moving all right-to-left CSS to a separate file.</p><pre>.wrapper {<br>    position: absolute;<br>    left: 0;<br>}</pre><pre>.media {<br>  float: left;<br>  margin-left: 20px;<br>}</pre><p>Create an rtl.css file that will include all RTL overrides. This file can be selectively loaded based on the locale (language).</p><pre>[dir=&quot;rtl&quot;].wrapper {<br>    right: 0;<br>    left: initial;<br>}</pre><pre>[dir=&quot;rtl&quot;].media {<br>    float: right;<br>    margin-right: 20px;<br>}</pre><p>For large projects, it is advisable to modularise and compile to a single rtl.output.css file.</p><p><strong>Automate RTL styles<br></strong>Compiling two separate CSS files, one for traditional LTR languages and one for RTL, is another way to optimise. Tools like <a href="https://rtlcss.com/">RTLCSS</a> helps us to create an RTL counterpart for our CSS automatically.</p><pre>output.css<br>p {<br>    padding-left: 1em;<br>    font-size: 1rem;<br>}<br><br>output.rtl.css:<br>p {<br>    padding-right: 1em;<br>    font-size: 1rem;<br>}</pre><p>RTLCSS comes with full support for all direction-sensitive CSS properties. Further, it provides processing directives (ignore, prepend, replace, remove, rename etc.) through CSS comments, so it can be explicitly controlled. Check out how RTLCSS works <a href="https://rtlcss.com/playground/">here</a>.</p><h4>More on logical properties</h4><p>CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties">Logical Properties</a> and Values provide the ability to control layout through logical, rather than physical, direction and dimension mappings. Logical properties define direction‐relative equivalents of their corresponding physical properties</p><blockquote>Thinking about start and end rather than left and right will be useful when dealing with layout methods such as CSS grid layout or flex box which follow the same patterns</blockquote><p>Commonly used logical values with interoperable support on all major browsers —</p><pre>text-align: start | end<br>justify-content: flex-start | flex-end<br>align-content: flex-start | flex-end<br>grid-column-start: &lt;value&gt;<br>grid-column-end: &lt;value&gt;<br>inline-size: &lt;width&gt;<br>margin-block-start/end: &lt;value&gt;<br>margin-inline-start/end: &lt;value&gt;<br>padding-block-start/end: &lt;value&gt;<br>padding-inline-start/end: &lt;value&gt;<br>border-inline-start/end: &lt;value&gt;</pre><p>Please refer to test <a href="https://www.w3.org/International/i18n-tests/results/css-logical">results</a> for browser support of logical properties and values.</p><h4>Finally</h4><p>This article aims to briefly explain the specifics of working on RTL websites. Please refer to the links provided for more information.</p><ul><li><a href="https://www.w3.org/TR/i18n-html-tech-bidi/">Authoring HTML: Handling Right-to-left Scripts</a></li><li><a href="https://www.w3.org/International/questions/qa-html-dir">Structural markup and right-to-left text in HTML</a></li><li><a href="https://hacks.mozilla.org/2015/09/building-rtl-aware-web-apps-and-websites-part-1/">Building RTL-Aware Web Apps &amp; Websites: Part 1 - Mozilla Hacks - the Web developer blog</a></li></ul><p>I appreciate you taking the time to read this article. Please leave a comment regarding how you found it.</p><p>Cheers,<br>-KK</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4573d8979db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s new in CSS?]]></title>
            <link>https://medium.com/@krishnakiran1992/whats-new-in-css-4bfecedae612?source=rss-da202a6e8627------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bfecedae612</guid>
            <category><![CDATA[styling]]></category>
            <category><![CDATA[css-for-beginner]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[frontend]]></category>
            <dc:creator><![CDATA[KK]]></dc:creator>
            <pubDate>Wed, 17 Aug 2022 06:04:59 GMT</pubDate>
            <atom:updated>2022-08-17T06:11:43.092Z</atom:updated>
            <content:encoded><![CDATA[<h4>A look at some of the latest and lesser known features in CSS</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*pwvlwDIVaLmkGqPNlpMgiA.jpeg" /><figcaption>What’s new in CSS</figcaption></figure><blockquote>CSS is constantly evolving. New features are developed and added to the CSS specification in response to real-world practices. Web enthusiasts may miss new features due to rapid evolution.</blockquote><h4>Evolution of CSS</h4><p>CSS has evolved from its first version (CSS1) which came in 1996. CSS2 followed around 1998 and now the W3C has decided that all CSS is CSS without a version number. CSS refers to everything published after CSS 2.1</p><p>The <a href="https://www.w3.org/Style/CSS/members">CSS Working Group</a> sometimes publishes snapshots, a collection of whole modules and parts of other drafts that are considered stable enough to be implemented by browser developers. Let’s take a look at a few of those exciting features that are updated in recent times.</p><h4>1. CSS property contain</h4><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/contain">contain</a> property allows an author to indicate that an element and its contents are, as much as possible, <em>independent</em> of the rest of the document tree</p><pre>div {<br>  contain: none;     | <em>no containment</em><br>  contain: layout;   | <em>how element relates to other elements<br>  </em>contain: paint;    | <em>how element is painted to screen<br>  </em>contain: size;     | <em>how element affects size calculations</em>  <br>  contain: style;    | <em>how CSS properties are contained</em><br>  contain: content;  | <em>combines layout and paint<br>  </em>contain: strict;   | <em>combines layout, paint, and size</em><br>}</pre><p><strong>How does it help us?<br></strong>Floating elements have a unique problem where they interfere with rendering their subsequent elements and layouts. We generally clear floats by using clearfix which can now be achieved using the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/contain">contain</a> property</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*ni3HERGue1_A11ZY84F4SA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1QNkPs4T28wa7FjJWoID_w.png" /><figcaption>CSS Contain working example</figcaption></figure><h4>2. CSS property accent-color</h4><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/accent-color">accent-color</a> property sets the accent colour for user-interface controls generated by some elements.</p><pre>input {<br>  accent-color: red;<br>}</pre><p><strong>How does it help us?</strong> <br>Browsers currently apply <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/accent-color">accent-color</a> to the following elements.<br>&lt;input type=&quot;checkbox&quot;&gt;<br>&lt;input type=&quot;radio&quot;&gt;<br>&lt;input type=&quot;range&quot;&gt;<br>&lt;progress&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*iKv1YHMvgJwK8esGPiIPAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*YgiLHhQEm-AI3NO3K9wX-A.png" /><figcaption>Customising input field using accent colour</figcaption></figure><h4>3. CSS at-rule supports</h4><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@supports">@supports</a> lets you specify declarations that depend on a browser&#39;s support for one or more specific CSS features</p><pre>@supports (display: grid) {<br>  div {<br>    display: grid;<br>  }<br>}</pre><pre>@supports not (display: grid) {<br>  div {<br>    float: right;<br>  }<br>}</pre><p><strong>How does it help us?<br></strong>@<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@supports">supports</a> allows us to write fallback CSS for browsers that do not support certain CSS properties. While using <a href="http://twitter.com/supports">@supports</a>, it makes sense to have a block that specifies what needs to be done when the feature is not supported.</p><h4>4. CSS at-rule counter-style</h4><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@counter-style">@counter-style</a> lets you define counter styles that are not part of the predefined set of styles. A <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@counter-style">@counter-style</a> rule defines how to convert a counter value into a string representation.</p><pre>@counter-style thumbs {<br>  system: cyclic;<br>  symbols: &quot;\1F44D&quot;;<br>  suffix: &quot; &quot;;<br>}<br><br>ul {<br>  list-style: thumbs;<br>}</pre><p><strong>How does it help us?<br></strong>Initially, CSS had a set of pre-defined counter styles which were never going to be enough for the evolving needs of the web. The <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@counter-style">@counter-style</a> addresses this shortcoming, by allowing us to define our counter styles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*k7GxgSZHUd108GhKY4GHzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*cLHNi_FuuG0NgPkgVw6IbA.png" /><figcaption>Custom Counter style <em>Thumbs — Counter Style Devanagari</em></figcaption></figure><p>Please note that<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@counter-style">@counter-style</a> is not fully supported and please refer to its <a href="https://caniuse.com/css-at-counter-style">usability</a> for specific needs.</p><h4>5. CSS module multi-column layout</h4><p>Adds support for <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Columns">multi-column</a> layouts. Support is included for establishing the number of columns in a layout, how content should flow from column to column, gap sizes between columns, and column rules along with their appearance.</p><pre>column-count | breaks content into # of columns<br>column-fill  | controls how columns are balanced<br>column-rule  | sets width, style, and colour of the line b/w columns<br>column-span  | makes element span across columns     <br>column-width | sets the ideal column width<br>column-gap   | sets the size of the gap (gutter space)<br>columns      | shorthand for column-count and column-width</pre><p><strong>How does it help us?<br></strong>Provides simple content splitting within an element by adjusting the content based on the number of columns and column widths specified. It allows us to create multiple columns without the need for any child elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*6SpZTplDLhaPDjMZbLHniQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0QseSL3hV9I7FUSnUmOH-A.png" /><figcaption>Multi-column layout</figcaption></figure><p>The multi-column layout is a useful feature to split the content into multiple columns. It supports additional fragmentation properties which specify how content is broken within columns. You can get more detail from <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Columns">here</a>.</p><blockquote>Check out exciting upcoming features if you enjoyed this post — <br><em>container</em> queries that are set to be a part of <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/contain"><em>contain</em></a>, <em>logical</em> <a href="https://www.w3.org/TR/css-conditional-5/"><em>when else</em></a> that extends support for the @supports rule, the <em>relational </em><a href="https://drafts.csswg.org/selectors/#relational"><em>has</em></a> pseudo selector.</blockquote><h4>Finally</h4><p>This article is a collection of a few CSS features that are relatively unknown and fairly stable across a wide spectrum of users. It is intended to give a brief overview of each feature. For more information, please refer to the links provided.</p><p>I appreciate you taking the time to read this article. Please leave a comment regarding how you found it.</p><p>Cheers,<br>-KK</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bfecedae612" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>