<?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: Dani Vijay</title>
    <description>The latest articles on DEV Community by Dani Vijay (@danivijay).</description>
    <link>https://dev.to/danivijay</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%2F67178%2Fddc8ae9a-2a6a-46c8-a57f-bab3d3bfae95.png</url>
      <title>DEV Community: Dani Vijay</title>
      <link>https://dev.to/danivijay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/danivijay"/>
    <language>en</language>
    <item>
      <title>Publish a React App in GitHub Pages with Custom Subdomain</title>
      <dc:creator>Dani Vijay</dc:creator>
      <pubDate>Mon, 05 Aug 2019 13:34:19 +0000</pubDate>
      <link>https://dev.to/danivijay/the-lazy-man-s-journey-to-publish-an-react-app-in-github-pages-with-custom-subdomain-43li</link>
      <guid>https://dev.to/danivijay/the-lazy-man-s-journey-to-publish-an-react-app-in-github-pages-with-custom-subdomain-43li</guid>
      <description>&lt;p&gt;Note: Skip next paragraph if you are not interested in backstory.&lt;/p&gt;

&lt;p&gt;I started learning 1 word per day from last week and documenting it via  twitter(&lt;a href="https://twitter.com/UtmostDev/status/1156447349373194240"&gt;https://twitter.com/UtmostDev/status/1156447349373194240&lt;/a&gt;). After few posts, I realised, the platform I chose was wrong. As I'm not a regular tweeter, this is gonna slowly dominate and pollute my feed. But I was not planning to drop #AWordEveryDay anytime soon. My only option was to find a new home for it. It's been some time since I developed a website from scratch, and I chose to do the same ASAP as a refresher.&lt;/p&gt;

&lt;p&gt;My obvious choice was &lt;code&gt;create-react-app&lt;/code&gt;. Making the website was pretty much straight forward, and it took around three hours to get the first draft ready(&lt;a href="https://github.com/danivijay/AWordEveryDay"&gt;https://github.com/danivijay/AWordEveryDay&lt;/a&gt;). &lt;/p&gt;

&lt;p&gt;As my code sits in GitHub, next step was to search how to deploy a react app using GitHub pages. Then the real problem began. There were tons of tutorials saying the same thing again and again - use gh-pages(&lt;a href="https://www.npmjs.com/package/gh-pages"&gt;https://www.npmjs.com/package/gh-pages&lt;/a&gt;). But at the time of writing, the package is not working as expected(&lt;a href="https://stackoverflow.com/questions/57314473/the-file-argument-must-be-of-type-string-received-type-undefined-on-npm-run-d"&gt;https://stackoverflow.com/questions/57314473/the-file-argument-must-be-of-type-string-received-type-undefined-on-npm-run-d&lt;/a&gt;). Even downgrading didn't resolved the issue(cache problem, may be). But after some research, I realised we can also directly deploy from &lt;code&gt;docs&lt;/code&gt; folder of the master. Renamed &lt;code&gt;build&lt;/code&gt; to &lt;code&gt;docs&lt;/code&gt; and after pushing, my app was up and running within minutes!!&lt;/p&gt;

&lt;p&gt;Second problem was routing my subdomain to the web app. Found out that routing my subdomain is as simple as adding a CNAME record with name as subdomain name (awordeveryday) and domain .github.io.(danivijay.github.io. - the dot in the end is needed). Initially the page showed a certificate error, but opening in incognito resolved the issue(cache problem again?).&lt;/p&gt;

&lt;p&gt;Last but not least, I noticed the custom domain configuration in settings resets every time I pushes something. Adding a file named &lt;code&gt;CNAME&lt;/code&gt; with my custom domain(awordeveryday.danivijay.com) in my docs folder(which I am publishing) solved the issue. &lt;/p&gt;

&lt;p&gt;The site is up and running at &lt;a href="https://awordeveryday.danivijay.com"&gt;https://awordeveryday.danivijay.com&lt;/a&gt;, and source can be found at &lt;a href="https://github.com/danivijay/AWordEveryDay"&gt;https://github.com/danivijay/AWordEveryDay&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>github</category>
      <category>githubpages</category>
      <category>subdomain</category>
    </item>
  </channel>
</rss>
