<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tomide Oladipo</title>
    <description>The latest articles on DEV Community by Tomide Oladipo (@tomiiide).</description>
    <link>https://dev.to/tomiiide</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F12526%2Fb9872312-7224-47e1-9f4d-5f9aef90b608.jpeg</url>
      <title>DEV Community: Tomide Oladipo</title>
      <link>https://dev.to/tomiiide</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tomiiide"/>
    <language>en</language>
    <item>
      <title>Import Javascript subfolder modules like a boss.</title>
      <dc:creator>Tomide Oladipo</dc:creator>
      <pubDate>Sun, 17 May 2020 12:03:06 +0000</pubDate>
      <link>https://dev.to/tomiiide/import-subfolder-modules-in-javascript-like-a-boss-15f7</link>
      <guid>https://dev.to/tomiiide/import-subfolder-modules-in-javascript-like-a-boss-15f7</guid>
      <description>&lt;p&gt;Have you worked on a project and find yourself writing code like this?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import { AddBank } from '../../../../pages/add-bank-account'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As projects get bigger, more folders get created, the deeper files are nested. Finding files can be a nightmare, and so does importing files. Having to import files like this might lead to some problems.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Inflexible code
&lt;/h3&gt;

&lt;p&gt;At a glance from the example above, it might not seem like a pain to do this, but let's assume our folder structure changes, and we move &lt;code&gt;add-bank-account.js&lt;/code&gt; to &lt;code&gt;pages/bank/add-bank-account&lt;/code&gt;. We would have to update the import statement in every file it was imported, which can lead to problems, depending on how many people work on the project and how large it is.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Hard to build mental models.
&lt;/h3&gt;

&lt;p&gt;While coding, we build mental models, that help us remember things faster. With this import structure, it's hard to figure out where this file is located at a glance, especially if we have multiple files with the same name &lt;code&gt;add-bank-account.js&lt;/code&gt; in different parts of our project.  &lt;/p&gt;

&lt;p&gt;This problem becomes apparent when onboarding a new developer to the codebase. It would be a pain for the newbie to figure out the folder structure of the app and where things are located.&lt;/p&gt;

&lt;h3&gt;
  
  
  A better way.
&lt;/h3&gt;

&lt;p&gt;What if we could import that function like this instead?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import { AddBank } from '@project/pages/add-bank-account'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If we change our file structure, all we have to do is change this to&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import { AddBank } from '@project/pages/bank/add-bank-account'&lt;/code&gt;  &lt;/p&gt;

&lt;p&gt;you would agree with me that this is much cleaner and we wouldn't have the problems associated with the initial approach.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ready to boss up?
&lt;/h3&gt;

&lt;p&gt;Thanks to the beautiful brains behind Node and npm, we can install folders as node modules. This allow for interesting use cases, including solving our ... problem.&lt;/p&gt;

&lt;p&gt;Boss up in 3, 2, 1:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;code&gt;package.json&lt;/code&gt; in the folder you want to access, in our case &lt;code&gt;/pages&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@project/pages&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;version&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0.0.1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;main&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;index.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Install the folder as a dependency, by running &lt;code&gt;npm install -S ./pages&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The folder should be added to your dependencies in the root &lt;code&gt;package.json&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;boss-subfolder-import&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;version&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1.0.0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;description&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Boss subfolder import&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;main&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;index.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scripts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;node index.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;author&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ayotomiiide@gmail.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;license&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ISC&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dependencies&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@project/pages&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;file:pages&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;^4.17.1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i.giphy.com/media/YwpylUojkfOZa/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/YwpylUojkfOZa/giphy.gif" alt="Welcome to the boss life!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Like and share this post if it was useful to you.&lt;/p&gt;

&lt;p&gt;Let me know what you think about this approach in the comments below, whether you agree with it or not.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>import</category>
    </item>
    <item>
      <title>6 HTML tips you did not know. </title>
      <dc:creator>Tomide Oladipo</dc:creator>
      <pubDate>Sun, 02 Feb 2020 18:16:36 +0000</pubDate>
      <link>https://dev.to/tomiiide/6-html-tips-you-did-not-know-3nek</link>
      <guid>https://dev.to/tomiiide/6-html-tips-you-did-not-know-3nek</guid>
      <description>&lt;h2&gt;
  
  
  Context
&lt;/h2&gt;

&lt;p&gt;I build a lot of email templates, at work.&lt;/p&gt;

&lt;p&gt;I wanted to be better, so I took a refresher course on HTML and CSS.&lt;/p&gt;

&lt;p&gt;As I clicked on "Begin Course", I felt like a fraud.&lt;/p&gt;

&lt;p&gt;"Bro, you have about 4 years experience building web apps, what the hell am I doing with learning HTML and CSS?", my inner voice said.&lt;/p&gt;

&lt;p&gt;I felt the same way Shakespeare would feel if he was learning ABC,s after writing Macbeth.&lt;/p&gt;

&lt;p&gt;If it's one thing every dev knows, it's that it's impossible to know everything. That's why we all read articles, do side projects, and Google search like crazy.&lt;/p&gt;

&lt;p&gt;Half of all Google searches are devs trying to figure out how to center divs. Another 10%, are devs searching for differences between a left join and a right join.&lt;/p&gt;

&lt;p&gt;Skipping the lamba, I learned a couple of things in my course that has improved my ability to write semantic HTML better, increasing accessibility in the web apps and email templates I build.&lt;/p&gt;

&lt;p&gt;Since sharing is caring, below are the top 8 new things I learned.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Blockquote and Cite element
&lt;/h3&gt;

&lt;p&gt;I never knew there were native elements for quotes, don't judge me. This group of elements is used to create quotes, the browser natively adds a margin to indent the content and styles the cite element. &lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/tomiiide/embed/wvBmMXq?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Figure and Figcaption elements
&lt;/h3&gt;

&lt;p&gt;I'll admit, I knew about the Figure element but never used it before. The Figure element is used for self-contained content, like code, images, videos, illustrations, etc. The figcaption tag is used to caption a figure and the browser loves it when you use captions. &lt;/p&gt;

&lt;p&gt;"Tomide, abeg, all these one na yarns, why should I use the Figure element ?" &lt;/p&gt;

&lt;p&gt;"You'd like for your web app to rank higher on search engines, right?"&lt;/p&gt;

&lt;p&gt;"Yes" &lt;/p&gt;

&lt;p&gt;"You'd like for your web app to rank higher on search engines, right?"&lt;/p&gt;

&lt;p&gt;"You'd like disabled people to access  content on your site with no problem, right?"&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/tomiiide/embed/mdyxPmq?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Create Detailed Emails with Anchor Links.
&lt;/h2&gt;

&lt;p&gt;Alright, this is one I knew but totally forgot about, you could include the subject of an email in an anchor element using the &lt;code&gt;mailto&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/tomiiide/embed/eYmrRwR?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Root relative paths
&lt;/h2&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;img src="/path/to/image.jpg" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This tells the browser, ignore the current path and start looking for the image from the root location of the website.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;img src="./path/to/image.jpg" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This tells the browser, start from the current path and start looking for the image.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Embedding SVGs
&lt;/h2&gt;

&lt;p&gt;There are many ways to embed SVGs, &lt;code&gt;inline&lt;/code&gt;, &lt;code&gt;img&lt;/code&gt;, &lt;code&gt;object&lt;/code&gt; . &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- a inline embed --&amp;gt;
&amp;lt;svg width="212" height="224" viewBox="0 0 212 224" fill="none" xmlns="http://www.w3.org/2000/svg"&amp;gt;
&amp;lt;path fill-rule="evenodd" clip-rule="evenodd" d="M106 212C164.542 212 212 164.542 212 106C212 47.4578 164.542 0 106 0C47.4578 0 0 47.4578 0 106C0 164.542 47.4578 212 106 212Z" fill="#081928"/&amp;gt;
&amp;lt;path d="M211.5 106C211.5 164.266 164.266 211.5 106 211.5C47.734 211.5 0.5 164.266 0.5 106C0.5 47.734 47.734 0.5 106 0.5C164.266 0.5 211.5 47.734 211.5 106Z" stroke="#1B3554" stroke-opacity="0.0198992"/&amp;gt;
&amp;lt;mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="212" height="212"&amp;gt;
&amp;lt;path fill-rule="evenodd" clip-rule="evenodd" d="M106 212C164.542 212 212 164.542 212 106C212 47.4578 164.542 0 106 0C47.4578 0 0 47.4578 0 106C0 164.542 47.4578 212 106 212Z" fill="white"/&amp;gt;
&amp;lt;path d="M211.5 106C211.5 164.266 164.266 211.5 106 211.5C47.734 211.5 0.5 164.266 0.5 106C0.5 47.734 47.734 0.5 106 0.5C164.266 0.5 211.5 47.734 211.5 106Z" stroke="white"/&amp;gt;
&amp;lt;/mask&amp;gt;
&amp;lt;/svg&amp;gt;

&amp;lt;!-- img method --&amp;gt;
&amp;lt;img src="/path/dramon.svg" alt="Illustration of Dramon the Dog" Title="Dramon the dog"/&amp;gt;

&amp;lt;!-- object element --&amp;gt;
&amp;lt;object type="image/svg+xml" data="/path/dramon.svg"&amp;gt;
    &amp;lt;!-- fallback embed --&amp;gt;
    &amp;lt;img src="/path/dramon.svg"/&amp;gt;
&amp;lt;/object&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Which is the best way? Like many things in tech, it depends on your situation. To make this decision, there are 3 main factors to consider&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Interactivity:  The &lt;code&gt;object&lt;/code&gt; and inline embed allows you to treat SVGs as HTML, animate, and manipulate SVG images with CSS and JS.&lt;/li&gt;
&lt;li&gt;SEO:  This is a little tricky, Google does not display inline SVG as part of the results in an image search, so if you want traffic from an image search, you should use 
&lt;code&gt;&amp;lt;img title="image title" alt="SEO keyword"/&amp;gt;&lt;/code&gt; . To optimize inline SVG for a web search, you can use ARIA attributes and &lt;/li&gt;
&lt;li&gt;Accessibility:  Only  &lt;code&gt;&amp;lt;img /&amp;gt;&lt;/code&gt; support the &lt;code&gt;alt&lt;/code&gt; and &lt;code&gt;title&lt;/code&gt; attributes that are read aloud by screen readers.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  6. Track element
&lt;/h2&gt;

&lt;p&gt;The track element is used to embed text for Video content on a page. &lt;/p&gt;

&lt;p&gt;It is best used for subtitles or closed captions but can be used for much more.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;video controls width="300" src="/path/to/your/video.mp4"&amp;gt;
    &amp;lt;track default kind="subtitles" srclang="end" src="/path/to/track.vtt"&amp;gt; 
&amp;lt;/video&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;




&lt;p&gt;Thanks for reading, If you found this article useful, please share to your dev friends on socials. &lt;/p&gt;

&lt;p&gt;Are there any other HTML tips you know about? Please share in the comments below.&lt;/p&gt;

</description>
      <category>html</category>
      <category>tips</category>
    </item>
    <item>
      <title>Hi, I'm Tomide Oladipo</title>
      <dc:creator>Tomide Oladipo</dc:creator>
      <pubDate>Mon, 15 May 2017 13:27:09 +0000</pubDate>
      <link>https://dev.to/tomiiide/hi-im-tomide-oladipo</link>
      <guid>https://dev.to/tomiiide/hi-im-tomide-oladipo</guid>
      <description>&lt;p&gt;I have been coding for 2 years.&lt;/p&gt;

&lt;p&gt;You can find me on GitHub as &lt;a href="https://github.com/tomiiide" rel="noopener noreferrer"&gt;tomiiide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I live in Nigeria.&lt;/p&gt;

&lt;p&gt;I work for Planet NEST&lt;/p&gt;

&lt;p&gt;I mostly program in these languages: PHP &amp;amp; JS.&lt;/p&gt;

&lt;p&gt;I am currently learning more about Javascript and React.&lt;/p&gt;

&lt;p&gt;Nice to meet you.&lt;/p&gt;

</description>
      <category>introduction</category>
    </item>
  </channel>
</rss>
