<?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: Ahmad Alfawwaz</title>
    <description>The latest articles on DEV Community by Ahmad Alfawwaz (@staa99).</description>
    <link>https://dev.to/staa99</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%2F287529%2Fc8598494-3add-43d1-9f23-5b109721c18e.jpeg</url>
      <title>DEV Community: Ahmad Alfawwaz</title>
      <link>https://dev.to/staa99</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/staa99"/>
    <language>en</language>
    <item>
      <title>Partial views/templates in plain HTML</title>
      <dc:creator>Ahmad Alfawwaz</dc:creator>
      <pubDate>Sun, 08 Dec 2019 23:06:48 +0000</pubDate>
      <link>https://dev.to/staa99/partial-views-templates-in-plain-html-27ni</link>
      <guid>https://dev.to/staa99/partial-views-templates-in-plain-html-27ni</guid>
      <description>&lt;p&gt;Recently, I worked on a static site in plain HTML, CSS and JavaScript. I had decided I was going to stick with just those without using any special tools to do any automation. Just write some plain old static HTML and deploy.&lt;/p&gt;

&lt;p&gt;Many frontend developers will obviously condemn this as unnecessary but I'm not a frontend developer and I didn't like the idea of setting up an environment for such a simple site.&lt;/p&gt;

&lt;p&gt;As expected, I had the common problem of repetition that is generally seen in static sites. Honestly, it's a pain to have to effect changes everywhere a reused part of a page is modified. I am from a .NET background and I have played with a few other frameworks so I know of .NET's Razor, Laravel's blade, Java's thymeleaf and several other view engines that offered partial views or partial templates as a feature to mitigate this particular issue.&lt;/p&gt;

&lt;p&gt;I researched solutions that enabled it in plain HTML and I found WebComponent's HTML Imports to be a good candidate. It was supposed to work with polyfills but for some reason I couldn't get it to behave the way I expected. I'm sure I could have possibly got it to work with some patience.&lt;/p&gt;

&lt;p&gt;I didn't have that kind of patience for such a simple requirement so I decided to make mine, and I did it with partials.js at &lt;a href="https://github.com/staa99/partials.js"&gt;https://github.com/staa99/partials.js&lt;/a&gt;. It offers the basic partial view support you'd need to avoid duplicating view implementations and it was the best tool for the job. It's currently at version 2.0.&lt;/p&gt;

&lt;p&gt;I encourage you to check it out, it might come in handy some day and you won't have to do all that work yourself anymore.&lt;/p&gt;

&lt;p&gt;Link: &lt;a href="https://github.com/staa99/partials.js"&gt;https://github.com/staa99/partials.js&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>html</category>
    </item>
  </channel>
</rss>
