<?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>Forem: Roshan Acharya</title>
    <description>The latest articles on Forem by Roshan Acharya (@coderosh).</description>
    <link>https://forem.com/coderosh</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%2F418758%2F608cbf44-31ea-483a-9be3-ad21659d6fad.jpeg</url>
      <title>Forem: Roshan Acharya</title>
      <link>https://forem.com/coderosh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/coderosh"/>
    <language>en</language>
    <item>
      <title>I built my own static site generator.</title>
      <dc:creator>Roshan Acharya</dc:creator>
      <pubDate>Wed, 22 Jul 2020 04:30:39 +0000</pubDate>
      <link>https://forem.com/coderosh/i-built-my-own-static-site-generator-22ak</link>
      <guid>https://forem.com/coderosh/i-built-my-own-static-site-generator-22ak</guid>
      <description>&lt;p&gt;Hi everyone,&lt;br&gt;
I'm writing my first article on dev.to and it's about the static site generator I have been building.&lt;/p&gt;

&lt;p&gt;About a month ago, I saw a website called &lt;code&gt;StaticGen&lt;/code&gt;(StaticGen has a list of static site generators for Jamstack sites). There were a lot of static sites generators that I thought why not challenge myself to build a static site generator.&lt;/p&gt;

&lt;p&gt;I knew that ssg generates static sites from markdown and other formats of files but I had no idea how. So, I did what must of us programmers do. I searched in google, "How to build static site generator". I found one useful blog which was a tutorial about creating a static site generator.&lt;/p&gt;

&lt;p&gt;After researching a bit, I begin to create my own static site generator. I was going to use mustache as a templating engine but I thought why not create my own templating engine. I used &lt;code&gt;vm&lt;/code&gt; module of nodejs and some regex to create a simple templating engine.&lt;/p&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;
      &lt;div class="ltag__twitter-tweet__media"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aNxM4qCs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/media/EdITGOXU0AAQIiu.png" alt="unknown tweet media content"&gt;
      &lt;/div&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--xFglKgnM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1283584531518255104/0emVSvpy_normal.jpg" alt="Roshan💥 JavaScript 💥 profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Roshan💥 JavaScript 💥
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        @acharyaroshanji
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      Compile and run javascript code within V8 Virtual Machine contexts using vm module.&lt;br&gt;&lt;br&gt;&lt;a href="https://twitter.com/hashtag/100DaysOfCode"&gt;#100DaysOfCode&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/Nodejs"&gt;#Nodejs&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/webdev"&gt;#webdev&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/javascript"&gt;#javascript&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/CodeNewbie"&gt;#CodeNewbie&lt;/a&gt; 
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      13:00 PM - 17 Jul 2020
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1284110735329484800" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1284110735329484800" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      6
      &lt;a href="https://twitter.com/intent/like?tweet_id=1284110735329484800" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      4
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;I used some npm packages like &lt;code&gt;frontmatter&lt;/code&gt;, &lt;code&gt;remarkable&lt;/code&gt; to parse markdown files. Then I built a live reload development server form scratch for my static site generator using &lt;code&gt;chokidar&lt;/code&gt; and &lt;code&gt;ws&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I named my static site generator as ulka (meteor) and my templating engine as ulka-parser and published them to npm. Then I created a new npm package &lt;code&gt;create-ulka-app&lt;/code&gt; which clones a default starter (&lt;a href="https://ulka-starter-default.netlify.app/"&gt;https://ulka-starter-default.netlify.app/&lt;/a&gt;) from GitHub and installs the npm packages. &lt;/p&gt;

&lt;p&gt;ulka: &lt;a href="https://github.com/ulkajs/ulka"&gt;https://github.com/ulkajs/ulka&lt;/a&gt;&lt;br&gt;
ulka-parser: &lt;a href="https://github.com/ulkajs/ulka-parser"&gt;https://github.com/ulkajs/ulka-parser&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ulka's working methodology is simple. It parses markdown and ulka files and creates html files. It changes the name of all assets and store in a single folder. Also, you can use javascript inside markdown files. Ulka also provides feature postParse and preParse that accepts array of functions that will run before(prePrase) or after(postParse) parsing markdown files. &lt;/p&gt;

&lt;p&gt;It's not completed yet, but my exams are coming soon. So, I will continue working on this after 1 month. It was fun creating it while learning.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Ignore this article.</title>
      <dc:creator>Roshan Acharya</dc:creator>
      <pubDate>Tue, 21 Jul 2020 09:11:21 +0000</pubDate>
      <link>https://forem.com/coderosh/ignore-this-article-5beo</link>
      <guid>https://forem.com/coderosh/ignore-this-article-5beo</guid>
      <description>&lt;p&gt;I don't know if anyone is seeing this. But if you are, ignore this article. I am new here and is just trying dev.to.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Blockquote ?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Heading 1
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Heading 2
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Heading 3
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Heading 4
&lt;/h4&gt;


&lt;div class="ltag__user ltag__user__id__"&gt;
  
    .ltag__user__id__ .follow-action-button {
      background-color: #19063A !important;
      color: #dce9f3 !important;
      border-color: #19063A !important;
    }
  
    &lt;div class="ltag__user__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b_Q_OnuL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--diPD5F8K--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://thepracticaldev.s3.amazonaws.com/i/99mvlsfu5tfj9m7ku25d.png" alt="[deleted user] image"&gt;
    &lt;/div&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;[Deleted User]&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      
    &lt;/div&gt;
    
  &lt;/div&gt;
&lt;/div&gt;



&lt;blockquote class="ltag__twitter-tweet"&gt;
      &lt;div class="ltag__twitter-tweet__media"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PzIN-5IE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/media/EdbzjFaUMAAPO47.png" alt="unknown tweet media content"&gt;
      &lt;/div&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--xFglKgnM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1283584531518255104/0emVSvpy_normal.jpg" alt="Roshan Acharya 🤠 profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Roshan Acharya 🤠
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        @acharyaroshanji
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      HTML escaper function&lt;br&gt;📓📓&lt;br&gt;&lt;a href="https://twitter.com/hashtag/javascript"&gt;#javascript&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/CodeNewbie"&gt;#CodeNewbie&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/100DaysOfCode"&gt;#100DaysOfCode&lt;/a&gt; 
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      08:02 AM - 21 Jul 2020
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1285485293483614208" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1285485293483614208" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      3
      &lt;a href="https://twitter.com/intent/like?tweet_id=1285485293483614208" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      6
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;
&lt;br&gt;


&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello World&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;p&gt;&lt;strong&gt;bold&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;italics&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;inline code&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 1&lt;/li&gt;
&lt;li&gt;item 2&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag__wikipedia--container"&gt;
  &lt;div class="ltag__wikipedia--header"&gt;
    &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BZyEeiGj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/wikipedia-logo-0a3e76624c7b1c3ccdeb9493ea4add6ef5bd82d7e88d102d5ddfd7c981efa2e7.svg" class="ltag__wikipedia--logo" alt="Wikipedia Logo"&gt;
    &lt;a href="https://en.wikipedia.org/wiki/Wikipedia" rel="noopener noreferrer"&gt;Wikipedia&lt;/a&gt;
  &lt;/div&gt;
  &lt;div class="ltag__wikipedia--extract"&gt;&lt;p&gt;&lt;b&gt;Wikipedia&lt;/b&gt; is a multilingual online encyclopedia created and maintained as an open collaboration project by a community of volunteer editors using a wiki-based editing system. It is the largest and most popular general reference work on the World Wide Web. It is also one of the 15 most popular websites as ranked by Alexa, as of August 2020. It features exclusively free content and has no advertising. It is hosted by the Wikimedia Foundation, an American non-profit organization funded primarily through donations.&lt;/p&gt;&lt;/div&gt;
  &lt;div class="ltag__wikipedia--btn--container"&gt;
    
      &lt;a href="https://en.wikipedia.org/wiki/Wikipedia" rel="noopener noreferrer"&gt;View on Wikipedia&lt;/a&gt;
    
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/dQw4w9WgXcQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Custom image&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CZRKzrHB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rvlm2ghnaceyktld052i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CZRKzrHB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rvlm2ghnaceyktld052i.png" alt="create-ulka-app"&gt;&lt;/a&gt;&lt;/p&gt;

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