<?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: naveennamani</title>
    <description>The latest articles on DEV Community by naveennamani (@naveennamani).</description>
    <link>https://dev.to/naveennamani</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%2F545031%2F891cb035-3297-45db-9f33-d782e69bf752.png</url>
      <title>DEV Community: naveennamani</title>
      <link>https://dev.to/naveennamani</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/naveennamani"/>
    <language>en</language>
    <item>
      <title>Hacktoberfest: let's contribute to my project offline-docs</title>
      <dc:creator>naveennamani</dc:creator>
      <pubDate>Sat, 01 Oct 2022 07:07:50 +0000</pubDate>
      <link>https://dev.to/naveennamani/hacktoberfest-lets-contribute-to-my-project-offline-docs-60j</link>
      <guid>https://dev.to/naveennamani/hacktoberfest-lets-contribute-to-my-project-offline-docs-60j</guid>
      <description>&lt;h2&gt;
  
  
  What is it?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/naveennamani/offline-docs"&gt;Offline-docs&lt;/a&gt; is a repository with a collection of scripts to generate offline documentation for many open-source projects. It's been a while I introduced this project in my &lt;a href="https://dev.to/naveennamani/introducing-offline-docs-collection-of-scripts-to-generate-offline-documentation-of-open-source-projects-1l7h"&gt;earlier post&lt;/a&gt;. Since then, I kept adding more and more projects to the repo and now it contains more than 50 scripts.&lt;/p&gt;

&lt;p&gt;This hacktoberfest let us make this project even more useful by contributing your valuable time and efforts. This post describes many ways in which you can make code and non-code contributions. But first, let me explain quickly how the project is organized.&lt;/p&gt;

&lt;h2&gt;
  
  
  Show me the code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/naveennamani"&gt;
        naveennamani
      &lt;/a&gt; / &lt;a href="https://github.com/naveennamani/offline-docs"&gt;
        offline-docs
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A collection of scripts to build offline documentation for your favourite frameworks/libraries. Simply search, copy/paste the commands and enjoy.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Offline-docs&lt;/h1&gt;
&lt;p&gt;A collection of scripts to build offline documentation for your favourite
frameworks/libraries/projects. Simply search, copy/paste the commands and enjoy.&lt;/p&gt;
&lt;h2&gt;
Available projects&lt;/h2&gt;
&lt;p&gt;Currently 51 projects available&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#backend"&gt;Backend&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#expressjs"&gt;expressjs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#nodejs"&gt;nodejs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#blockchain"&gt;Blockchain&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#ethereum"&gt;ethereum&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#hardhat"&gt;hardhat&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#maticjs"&gt;matic.js&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#polygon-matic"&gt;polygon (matic)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#solidity"&gt;solidity&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-1"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#waffle"&gt;waffle&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-2"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#build-tools"&gt;Build tools&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#vite"&gt;vite&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#cross-platform-app-development"&gt;Cross platform app development&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#react-native"&gt;React Native&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#tauri"&gt;tauri&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#css-frameworkslibraries"&gt;CSS frameworks/libraries&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#bootstrap-5"&gt;bootstrap 5&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#daisyui"&gt;daisyui&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#material-ui"&gt;material ui&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#polygonmesh"&gt;polygonmesh&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-3"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#storybook"&gt;storybook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#tailwindcss"&gt;tailwindcss&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#windicss"&gt;windicss&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#frontend-javascript-frameworkslibraries"&gt;Frontend javascript frameworks/libraries&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#axios"&gt;axios&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#react-redux"&gt;react-redux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#reactjs"&gt;reactjs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#redux"&gt;redux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#redux-toolkit"&gt;redux toolkit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#rxjs"&gt;RxJS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#vuejs-v3"&gt;vuejs V3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#javascript-testing-libraries"&gt;Javascript testing libraries&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#chaijs"&gt;chaijs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#mochajs"&gt;mochajs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#playwrightdev"&gt;playwright.dev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#machine-learning"&gt;Machine learning&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#keras"&gt;keras&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#numpy"&gt;numpy&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-4"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#numpy-tutorials"&gt;numpy-tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#pandas"&gt;pandas&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-5"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#scipy-cookbook"&gt;scipy cookbook&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-6"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#scipy-devdocs"&gt;scipy devdocs&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-7"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#scipyorg-website"&gt;scipy.org website&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#programming-languages"&gt;Programming languages&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#gobyexample"&gt;gobyexample&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#python"&gt;Python&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#pydantic"&gt;pydantic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#requests"&gt;requests&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-8"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#sqlalchemy"&gt;sqlalchemy&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-9"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#typer"&gt;typer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#python-web-frameworks"&gt;Python web frameworks&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#bottle"&gt;bottle&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-10"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#django"&gt;django&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#direct-links-11"&gt;Direct links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#fastapi"&gt;fastapi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#flask"&gt;flask&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#ssg-ssr"&gt;SSG, SSR&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#nuxtjs"&gt;Nuxtjs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#nuxtjs-v3"&gt;Nuxtjs V3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#vitepress"&gt;vitepress&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/naveennamani/offline-docs#other"&gt;Other&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#eslint"&gt;eslint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#mozilla-developer-network"&gt;Mozilla Developer Network&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#prettier"&gt;prettier&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/naveennamani/offline-docs#typescript"&gt;typescript&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
But why? / Motivation&lt;/h2&gt;
&lt;p&gt;Learning or working on a new…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/naveennamani/offline-docs"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Setup
&lt;/h3&gt;

&lt;p&gt;This project uses yaml files for storing data related to each project. The projects are grouped into project groups based on the common theme. This project uses node.js to handle these yaml files and to automatically and consistently generate README.md file.&lt;/p&gt;

&lt;p&gt;So, before contributing anything, first install all dependencies by running &lt;code&gt;npm run install&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contributing to the project
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Adding a new project
&lt;/h3&gt;

&lt;p&gt;For adding a new project or project group a script &lt;code&gt;cli.js&lt;/code&gt; is provided. When you run the script, it asks for the required information and stores them in yaml files and updates the README. The &lt;code&gt;git clone ... &amp;amp; cd dir&lt;/code&gt; commands will be added by the script. So, only enter the required commands to be run after cloning the repository.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When in doubt, run the script and look at the generated readme file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Modifying/updating an existing project
&lt;/h3&gt;

&lt;p&gt;For modifying details of any existing project, modify appropriate yaml file in &lt;code&gt;projects&lt;/code&gt; folder and then run &lt;code&gt;index.js&lt;/code&gt; script to format the yaml files and to update the README.md file with the changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Non-code contributions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Testing the scripts
&lt;/h3&gt;

&lt;p&gt;As the source code of the project changes, sometimes we may need to update the scripts. That is why last tested details are given for each project. If you happen to be testing the script and it worked, you can update the last tested date.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To limit the possibility of simply updating the date without actually testing, you are required to post a screenshot in the PR request comments showing that you are able to access it offline.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Request more projects
&lt;/h3&gt;

&lt;p&gt;If you require scripts for any project that you want to generate offline documentation for, you can add them in the TODO.md file with following details&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Website URL&lt;/li&gt;
&lt;li&gt;Source code repo for the project&lt;/li&gt;
&lt;li&gt;Any commands that you've already tried (optional)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The source code repo URL is required and it shows that you've done your own research.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other contributions
&lt;/h2&gt;

&lt;p&gt;You can follow the issues and can work on them if interested. But please let me know before you start working on it, so another person may not waste their time.&lt;/p&gt;

&lt;p&gt;Looking forward for your contributions :)&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>documentation</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to stay motivated on your side projects? 🤔🤷‍♂️</title>
      <dc:creator>naveennamani</dc:creator>
      <pubDate>Sun, 24 Apr 2022 06:14:27 +0000</pubDate>
      <link>https://dev.to/naveennamani/how-to-stay-motivated-on-your-side-projects-3al1</link>
      <guid>https://dev.to/naveennamani/how-to-stay-motivated-on-your-side-projects-3al1</guid>
      <description>&lt;p&gt;We all have so many half-baked projects that we don't want to go back to. Still, we have unicorn ideas that we can't wait to start. In turning that unicorns to donkeys we all become developers.&lt;/p&gt;

&lt;p&gt;But how do you stay motivated in creating those donkeys? Well here are some of my opinions and learnings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Whether half-baked or full, learn the skills of baking
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Side projects are for learning at your own pace.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most of my programming experience comes from my side projects. I learnt multiprocessing and process queues in python when I thought about gifting my friend a mosaic image. Even though it was a bummer, later it helped me at my workplace. Similarly, I touched on so many things (unfinished) just to learn something new.&lt;/p&gt;

&lt;p&gt;What makes learning at workplace different from side projects is working at your own pace. And personally I feel more confident about my knowledge when I learn it in my own way. Most of you might agree on this one, so if you like learning at your own pace, &lt;strong&gt;start a new side project around what you want to learn&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do something today that your future self will thank you for
&lt;/h2&gt;

&lt;p&gt;No matter how small your side project is, sometimes it helps you or someone else at the right time. Whether it's 10 lines automation script, or 1000 lines of code, when time comes, you appreciate yourself. This may not always happen, but keeping your projects code accessible will help you in solving the problems that you already solved once.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqbd93pr8y16lmqerv1lv.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqbd93pr8y16lmqerv1lv.jpeg" alt="stackoverflow meme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So while starting a new project, just make sure you keep the code accessible. May be push it to a private repository, or make a new secret gist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the ideas coming
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Ideas are so powerful, they start small and when given enough thoughts and time, they can solve real world problems.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;All side projects starts with some idea. Whether it's useful or not, unique or copied, dumb or smart, but there will always be some idea that you try to implement. Many times one idea lead to another, whether its small improvements or your unique signature, it helps you in exploring many things. With time and exploration, you'll understand if an idea is worth spending your time. Every idea you understand, will help you with some new ideas and solutions. Remember, at the end of the day, it's your ideas that solves the problem and not the number of languages/libraries/frameworks you know.&lt;/p&gt;

&lt;p&gt;So, keep pushing your brain to process more ideas, and to generate more ideas.&lt;/p&gt;

&lt;p&gt;These are just my opinions on what I learned through many of my side projects. Comment down below your experience and learnings :).&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>productivity</category>
      <category>watercooler</category>
      <category>programming</category>
    </item>
    <item>
      <title>Introducing offline-docs, collection of scripts to generate offline documentation of open-source projects</title>
      <dc:creator>naveennamani</dc:creator>
      <pubDate>Sun, 17 Apr 2022 01:35:49 +0000</pubDate>
      <link>https://dev.to/naveennamani/introducing-offline-docs-collection-of-scripts-to-generate-offline-documentation-of-open-source-projects-1l7h</link>
      <guid>https://dev.to/naveennamani/introducing-offline-docs-collection-of-scripts-to-generate-offline-documentation-of-open-source-projects-1l7h</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/naveennamani/offline-docs"&gt;Offline-docs&lt;/a&gt; is a repo with collection of scripts to build offline documentation for your favourite frameworks/libraries. Simply search 🔎 for your tool, copy/paste the build commands and enjoy.&lt;/p&gt;

&lt;h2&gt;
  
  
  But why? / Motivation
&lt;/h2&gt;

&lt;p&gt;Learning or working on a new language often requires referring to the official docs multiple times. With the rise of &lt;strong&gt;Static Site Generation (SSG)&lt;/strong&gt; many documentation sites are now open-source  and can be built for offline usage. This project aims to collect all such websites and the build commands to have a knowledge of widely used SSG tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use this repo
&lt;/h2&gt;

&lt;p&gt;Details about each tool such as website, source code repo and build commands are given in README page of the &lt;a href="https://github.com/naveennamani/offline-docs"&gt;repo&lt;/a&gt;. Once you are on the repo&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Find the framework/library/tool for which you want to build the documentation (you can search in the &lt;a href="https://github.com/naveennamani/offline-docs#available-tools"&gt;Available Tools&lt;/a&gt; or with Ctrl+F)&lt;/li&gt;
&lt;li&gt;Open a new terminal&lt;/li&gt;
&lt;li&gt;Copy paste the build commands shown for the tool&lt;/li&gt;
&lt;li&gt;Open the output dir as mentioned in the last command (or) unarchive the
.tar.gz file in your preferred location and rename the folder&lt;/li&gt;
&lt;li&gt;Use any static site serving tools like
&lt;a href="https://www.npmjs.com/package/serve"&gt;serve (npm package)&lt;/a&gt; or simply
&lt;code&gt;python -m http.server&lt;/code&gt;. (We recommend using serve package)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Currently available tools
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Blockchain

&lt;ul&gt;
&lt;li&gt;ethereum&lt;/li&gt;
&lt;li&gt;hardhat&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Build tools

&lt;ul&gt;
&lt;li&gt;vite&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;CSS frameworks/libraries

&lt;ul&gt;
&lt;li&gt;daisyui&lt;/li&gt;
&lt;li&gt;material ui&lt;/li&gt;
&lt;li&gt;tailwindcss&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Frontend javascript frameworks/libraries

&lt;ul&gt;
&lt;li&gt;reactjs&lt;/li&gt;
&lt;li&gt;vuejs v3&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Javascript testing libraries

&lt;ul&gt;
&lt;li&gt;chaijs&lt;/li&gt;
&lt;li&gt;mochajs&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Other

&lt;ul&gt;
&lt;li&gt;eslint&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many more websites are coming soon (including Mozilla Developer Network (mdn) 😉). So, go to the repository, create a star ⭐ and show your love ❤️ towards the project.&lt;/p&gt;

&lt;p&gt;Thanks for your time!&lt;/p&gt;




&lt;p&gt;Visit my blog for latest articles related to web development&lt;br&gt;
&lt;a href="https://naveennamani.github.io/blog"&gt;https://naveennamani.github.io/blog&lt;/a&gt; and&lt;br&gt;
for projects like this.&lt;/p&gt;

</description>
      <category>documentation</category>
      <category>showdev</category>
      <category>productivity</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Using vite-plugin-ssr with mdx-js, solving ESM only library problems, understanding vite configuration and writing vite plugins</title>
      <dc:creator>naveennamani</dc:creator>
      <pubDate>Thu, 31 Mar 2022 19:01:28 +0000</pubDate>
      <link>https://dev.to/naveennamani/using-vite-plugin-ssr-with-mdx-js-solving-esm-only-library-problems-understanding-vite-configuration-and-writing-vite-plugins-3b24</link>
      <guid>https://dev.to/naveennamani/using-vite-plugin-ssr-with-mdx-js-solving-esm-only-library-problems-understanding-vite-configuration-and-writing-vite-plugins-3b24</guid>
      <description>&lt;p&gt;&lt;a href="https://vite-plugin-ssr.com/" rel="noopener noreferrer"&gt;vite-plugin-ssr&lt;/a&gt; is vite plugin which allows us to build websites with Server Side Rendering, Client Side Rendering, Single Page Applications and Static Site Generation all in one. This plugin is like Next.js but provides more control over each page and for any of your favorite frontend framework. Please visit the website to learn how to use this plugin.&lt;/p&gt;

&lt;p&gt;In this tutorial we'll learn how to setup mdx-js library for vite project for building markdown based websites and to prerender them  using vite-plugin-ssr to generate static websites.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;a href="https://github.com/brillout/vite-plugin-ssr/tree/master/examples" rel="noopener noreferrer"&gt;vite-plugin-ssr github repo&lt;/a&gt; contains example projects which you can clone and start with. For example &lt;a href="https://github.com/brillout/vite-plugin-ssr/tree/master/examples/react-full" rel="noopener noreferrer"&gt;react-full example&lt;/a&gt; already provides a setup for working with mdx-js library. The intention of this tutorial is to show how to solve some of the problems I encountered while using the mdx-js library and vite-plugin-ssr prerender feature.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Project setup
&lt;/h2&gt;

&lt;p&gt;First of all, we need to setup a vite + vite-plugin-ssr based project. To scaffold a vite-plugin-ssr project simply execute&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init vite-plugin-ssr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Give your project a name (I named it nn-blog) and select the frontend framework (in this example react) you would like to use. Once the command runs simply go to your project folder and install all dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;nn-blog
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run the dev server with &lt;code&gt;npm run dev&lt;/code&gt;. Congratulations, you've just setup a vite + vite-plugin-ssr based project. The setup comes initialized with a git repo, so you can start modifying the code around. And you'll notice how blazingly fast the vite dev server is.&lt;/p&gt;

&lt;p&gt;Once you understand the &lt;a href="https://vite-plugin-ssr.com/filesystem-routing" rel="noopener noreferrer"&gt;filesystem routing&lt;/a&gt; concepts of vite-plugin-ssr, create some pages and experiment. When you're ready let's start with adding mdx-js.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding mdx-js to vite project
&lt;/h2&gt;

&lt;p&gt;mdx-js is a library which converts markdown content to jsx compatible content that you can then use with your jsx based libraries such as react, preact, vue.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;MDX allows you to use JSX in your markdown content. You can import components, such as interactive charts or alerts, and embed them within your content.&lt;br&gt;
vite uses rollup under the hood to build bundles for production. So for installing mdx-js to a vite project, we should use &lt;code&gt;@mdx-js/rollup&lt;/code&gt; and for handling custom MDX components we can use &lt;code&gt;@mdx-js/react&lt;/code&gt; for react based projects.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @mdx-js/rollup @mdx-js/react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the libraries are installed, add mdx-js to vite plugins in &lt;code&gt;vite.config.js&lt;/code&gt; file and config the mdx plugin to use @mdx-js/react as an proiderImportSource.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="p"&gt;import react from '@vitejs/plugin-react'
import ssr from 'vite-plugin-ssr/plugin'
&lt;/span&gt;&lt;span class="gi"&gt;+import mdx from "@mdx-js/rollup"
&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;span class="p"&gt;export default {
&lt;/span&gt;&lt;span class="gd"&gt;- plugins: [react(), ssr()]
&lt;/span&gt;&lt;span class="gi"&gt;+ plugins: [react(), mdx({
+   providerImportSource: "@mdx-js/react"
+ }), ssr()],
&lt;/span&gt;}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solving problem 1 - require() of ES Module is not supported
&lt;/h2&gt;

&lt;p&gt;Now after updating the &lt;code&gt;vite.config.js&lt;/code&gt; if we try to run &lt;code&gt;npm run dev&lt;/code&gt; we'll be given this confusing error&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;failed to load config from /workspace/example/nn-blog/vite.config.js
/workspace/example/nn-blog/vite.config.js:61509
undefined
            ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /workspace/example/nn-blog/node_modules/@mdx-js/rollup/index.js from /workspace/example/nn-blog/vite.config.js not supported.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This problems occurs in the following order.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;npm run dev&lt;/code&gt; runs &lt;code&gt;node ./server/index.js&lt;/code&gt; file which is a commonjs file&lt;/li&gt;
&lt;li&gt;The script creates vite dev server using &lt;code&gt;vite.createServer&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;The vite dev server converts &lt;code&gt;vite.config.js&lt;/code&gt; to CJS module first and then loads the config from this file.&lt;/li&gt;
&lt;li&gt;As CJS module tries to &lt;code&gt;require("@mdx-js/rollup")&lt;/code&gt; plugin which is a ESM only module the error will be generated.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To solve this problem, we should inform vite to skip building config file to CJS. This can be achieved by adding&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gi"&gt;+ "type": "module",
&lt;/span&gt;}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to &lt;code&gt;package.json&lt;/code&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solving problem 2 - require() is not defined in ES module scope
&lt;/h2&gt;

&lt;p&gt;Once we inform node to enable ES modules, we cannot use &lt;code&gt;require&lt;/code&gt; syntax in &lt;code&gt;.js&lt;/code&gt; files. This is exactly what you'll get when you run &lt;code&gt;npm run dev&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;file:///workspace/example/nn-blog/server/index.js:1
const express = require('express')
                ^

ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/workspace/example/nn-blog/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Luckily, the error itself gave us a solution. But you need to first stop scratching your head and learn to read those lines in to identify the solution. If you look carefully what we need is just to rename our &lt;code&gt;index.js&lt;/code&gt; file to &lt;code&gt;index.cjs&lt;/code&gt; and 💣&lt;/p&gt;

&lt;h2&gt;
  
  
  Solving problem 3 - Cannot find module
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/workspace/example/nn-blog/server'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wait, where is our file gone? Node says it can't find it, but it's there right in the server folder.&lt;/p&gt;

&lt;p&gt;May be if you're patient enough or highly talented nerd enough, you'll understand that node is trying to load &lt;code&gt;server&lt;/code&gt; module and not &lt;code&gt;server/index.js&lt;/code&gt;. The &lt;code&gt;/index.js&lt;/code&gt; file comes into picture as part of the &lt;a href="https://nodejs.org/docs/latest-v13.x/api/modules.html" rel="noopener noreferrer"&gt;CJS module loading sequence of node&lt;/a&gt;. So, we need to add a &lt;code&gt;package.json&lt;/code&gt; file with the following value&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"main"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"index.cjs"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And ✨ congratulations, you are now ready to go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding a markdown page
&lt;/h2&gt;

&lt;p&gt;Now go to pages directory and any markdown content with &lt;code&gt;.md&lt;/code&gt; or &lt;code&gt;.mdx&lt;/code&gt; extention. For example, for creating a &lt;code&gt;/naveennamani&lt;/code&gt; root, add &lt;code&gt;pages/naveennamani.page.mdx&lt;/code&gt; or &lt;code&gt;pages/naveennamani/index.page.mdx&lt;/code&gt; or &lt;code&gt;pages/index/naveennamani.page.mdx&lt;/code&gt; file. (I prefer the last filename for this example).&lt;/p&gt;

&lt;p&gt;Once you create the file add any markdown content, hit [localhost:3000/naveennamani] url to see your markdown content getting converted into html. For using react components inside your mdx files simply import them and use.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Hello world

import { Counter } from './Counter'

&amp;lt;Counter /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will show a heading with an interactive counter that is also shown on home page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerendering and inventing new problems
&lt;/h2&gt;

&lt;p&gt;When you stop the dev server and want to build your awesome website as a static content, you can use vite-plugin-ssr prerender feature. Just add the following script to &lt;code&gt;package.json&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
   ...
   "prerender": "npm run build &amp;amp;&amp;amp; vite-plugin-ssr prerender"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you run &lt;code&gt;npm run prerender&lt;/code&gt;, you'll see that &lt;code&gt;dist\client&lt;/code&gt; and &lt;code&gt;dist\server&lt;/code&gt; folders are created and build files are populated there. But prerendering is failing with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/workspace/example/nn-blog/dist/server/assets/naveennamani.page.04918628.js:4
var react = require("@mdx-js/react");
            ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /workspace/example/nn-blog/node_modules/@mdx-js/react/index.js from /workspace/example/nn-blog/dist/server/assets/naveennamani.page.04918628.js not supported.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Isn't that the same problem we solved earlier? Yes. But why again? 😢&lt;br&gt;
This time the problem is created in the following order.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you run &lt;code&gt;npm run build&lt;/code&gt; it runs &lt;code&gt;vite build&lt;/code&gt; and &lt;code&gt;vite build --ssr&lt;/code&gt; with the first command building assets for &lt;code&gt;dist\client&lt;/code&gt; and second command for &lt;code&gt;dist\server&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;While &lt;code&gt;dist\client&lt;/code&gt; assets are all &lt;code&gt;esm&lt;/code&gt; modules, &lt;code&gt;dist\client&lt;/code&gt; build output are &lt;code&gt;cjs&lt;/code&gt; modules.&lt;/li&gt;
&lt;li&gt;So, again &lt;code&gt;@mdx-js/react&lt;/code&gt; which is a ESM only module is failed to import through &lt;code&gt;require&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This time, we can generate ES modules instead of CJS modules by configuring build options in &lt;code&gt;vite.config.js&lt;/code&gt; as follows&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;  import react from '@vitejs/plugin-react'
  import ssr from 'vite-plugin-ssr/plugin'
  import mdx from "@mdx-js/rollup"
&lt;span class="gi"&gt;+ import { defineConfig } from 'vite'
&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;span class="gi"&gt;+ export default defineConfig({
&lt;/span&gt;    plugins: [react(), mdx({
      providerImportSource: "@mdx-js/react"
    }), ssr()],
&lt;span class="gi"&gt;+   build: {
+     rollupOptions: {
+       output: {
+         format: "es"
+       }
+     }
+   }
+ })
&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you run &lt;code&gt;npm run prerender&lt;/code&gt; again, you can see that &lt;code&gt;dist\server&lt;/code&gt; folder contains files which are ES modules. But you still get this complicated error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/workspace/example/nn-blog/node_modules/react/jsx-runtime' imported from /workspace/example/nn-blog/dist/server/assets/index.page.0262694b.js
Did you mean to import react/jsx-runtime.js?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Writing a vite plugin to solve our problems
&lt;/h2&gt;

&lt;p&gt;At first sight, the error seems like a spelling mistake. But if you google, there is a &lt;a href="https://github.com/facebook/react/issues/20235" rel="noopener noreferrer"&gt;long list of comments&lt;/a&gt; in the official react repo (issue #20235). The problem can be simply solved by adding .js extension to the import, but how to do that automatically?&lt;/p&gt;

&lt;p&gt;Let's write a vite plugin to do that for us. Writing a vite plugin is very simple if you follow the &lt;a href="https://vitejs.dev/guide/api-plugin" rel="noopener noreferrer"&gt;Vite plugin API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is what I come with.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fix_ssr_esm_modules&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;replacements&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ssr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ssr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// ssr is true when `vite build --ssr` is run&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;replacements&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;prevCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;find&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;replacement&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;prevCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replaceAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;find&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;replacement&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// configuration of our plugin used by vite&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vite-plugin-fix-ssr-esm-modules&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;build&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// execute only for build tasks&lt;/span&gt;
    &lt;span class="na"&gt;enforce&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;post&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// execute after build finished&lt;/span&gt;
    &lt;span class="na"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// transformation function that returns transformed code&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;Now place the code in fix_ssr_esm_modules.js file and then import and use this plugin in &lt;code&gt;vite.config.js&lt;/code&gt; file as follows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gi"&gt;+ import fix_ssr_esm_modules from "./fix_ssr_esm_imports.js";
&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;span class="p"&gt;export default defineConfig({
&lt;/span&gt;  plugins: [
    react(),
    mdx({
      providerImportSource: "@mdx-js/react",
    }),
    ssr(),
&lt;span class="gi"&gt;+   fix_ssr_esm_modules([
+     { find: "react/jsx-runtime", replacement: "react/jsx-runtime.js" },
+     { find: "react-dom/server", replacement: "react-dom/server.js" },
+   ]),
&lt;/span&gt;  ],
  build: {
    rollupOptions: {
      output: {
        format: "es",
      },
    },
  },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The plugin transforms the build files and replaces the import as given as options to the plugin.&lt;/p&gt;

&lt;p&gt;Now you can run &lt;code&gt;npm run prerender&lt;/code&gt; and serve the files in &lt;code&gt;dist\client&lt;/code&gt; statically using &lt;code&gt;npx serve&lt;/code&gt;. Congratulations 🌟, you just built a static site using vite-plugin-ssr.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final touch
&lt;/h2&gt;

&lt;p&gt;The final version of the source code of the project is available in github &lt;a href="https://github.com/naveennamani/vite-ssr-mdx" rel="noopener noreferrer"&gt;naveennamani/vite-ssr-mdx&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There is a small inconsistency with &lt;code&gt;server/index.js&lt;/code&gt; file, but that's an alternative I found while I'm writing this article.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sorry for the long post, if you come here after all, here is a potato for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuo9nvf5zpvlr2csi64kw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuo9nvf5zpvlr2csi64kw.jpg" alt="Potato"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>vite</category>
      <category>react</category>
    </item>
    <item>
      <title>My #hacktoberfest2021 honest review</title>
      <dc:creator>naveennamani</dc:creator>
      <pubDate>Wed, 03 Nov 2021 08:10:54 +0000</pubDate>
      <link>https://dev.to/naveennamani/my-hacktoberfest2021-honest-review-4a2i</link>
      <guid>https://dev.to/naveennamani/my-hacktoberfest2021-honest-review-4a2i</guid>
      <description>&lt;p&gt;I always love open-source projects for their quality and the amazing community who build it through their contributions. Whenever I'm in need of any professional software for day-to-day productivity or hobby projects for personal use, I always search in google along with "open-source" keyword. I found so many such open-source projects which I end up using very frequently. &lt;a href="https://github.com/jgraph/drawio"&gt;apps.diagrams.net (formerly draw.io)&lt;/a&gt;, &lt;a href="https://github.com/greenshot/greenshot"&gt;Greenshot&lt;/a&gt;, &lt;a href="https://gitlab.com/mayan-edms/mayan-edms"&gt;Mayan EDMS&lt;/a&gt;, &lt;a href="https://github.com/WinMerge/winmerge"&gt;WinMerge&lt;/a&gt;, Notepad++, Visual Studio Code are to name a few.&lt;/p&gt;

&lt;h2&gt;
  
  
  Early contributions
&lt;/h2&gt;

&lt;p&gt;Even though I use open-source projects, I rarely contribute to them. I often create issues whenever I found problems, but I never go deep into the source-code that I go and solve the issue I just found. But whenever I feel like something can be improved/added without disturbing the existing features, I often tend to work on it.&lt;/p&gt;

&lt;p&gt;This is how I made my first contribution in early 2017 in this project &lt;a href="https://github.com/antimatter15/jsgif"&gt;jsgif&lt;/a&gt;. (The project is not maintained now and my PR is the last commit in the repo). Similarly, I made three more contributions in other projects. However, my biggest contribution was to the project &lt;a href="https://github.com/Z4nzu/hackingtool"&gt;hackingtool&lt;/a&gt; &lt;a href="https://github.com/Z4nzu/hackingtool/pull/79"&gt;#79&lt;/a&gt; where I rewrote the entire project to be more maintainable, uniform and easier to contribute to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hacktoberfest 2021
&lt;/h2&gt;

&lt;p&gt;This year, some how I motivated myself to participate in Hacktoberfest 2021 (but 20 days late to the party). It felt difficult to make 4 PRs in 10 days. At the same time, I took it as a challenge.&lt;/p&gt;

&lt;h3&gt;
  
  
  Finding projects
&lt;/h3&gt;

&lt;p&gt;As I mentioned earlier, I feel comfortable to add something to the project without disturbing the existing code. So, I immediately started searching for projects which are kind of collection of scripts. After going through many projects, I found 4 projects and made some small PRs. As all the projects I contributed to are already popular, there are 100's of pending PRs waiting to be merged.&lt;/p&gt;

&lt;h3&gt;
  
  
  Waiting...
&lt;/h3&gt;

&lt;p&gt;Being a little impatient, waiting for the PRs to get accepted seems like more challenging than to create the PRs. Some projects have contributing guidelines, and many projects have their own coding preferences, workflows, review/approve users. Some of the things I noticed that are barriers for first-time contributors are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Workflows - for some workflows to run for first-time contributors, maintainers must initiate the workflow. Till then, you won't know if your PR follows the guidelines or if your PR will raise conflicts. Being first time contribution to a project, there are high chances of non-compliance to the guidelines.&lt;/li&gt;
&lt;li&gt;Changes and review process - If maintainers propose changes, you've to go through the "Change"-&amp;gt;"Push"-&amp;gt;"Request for Review"-&amp;gt;"Wait" cycle. If the maintainers who were asked for review are not active while no other maintainers looks at your PR as they're not assigned, the delay in merging the PR will be more.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Small projects to the rescue
&lt;/h3&gt;

&lt;p&gt;While popular projects with so many maintainers, workflows and guidelines attracts you to contribute, the real satisfactory contributions will always belong to small unpopular projects. As I was waiting for my 4 PRs while they're in the "reviewing/neglected" state, I found this project &lt;a href="https://github.com/BraydenTW/react-tailwind-portfolio"&gt;react-tailwind-portfolio&lt;/a&gt; which I contributed to and got my first ever "hacktoberfest-accepted" label within 24Hrs of finding the project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Finally done with 4 PRs
&lt;/h3&gt;

&lt;p&gt;After my first PR, 3 out of the earlier 4 PRs are merged and I finished my #hacktoberfest challenge. As I was writing this post, one of my PR is still waiting to be merged :(.&lt;/p&gt;

&lt;h3&gt;
  
  
  Takeaways and suggestion to my future self
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Always try to contribute to small projects&lt;/li&gt;
&lt;li&gt;Create issue first and work on the PR&lt;/li&gt;
&lt;li&gt;Try to solve the existing issues by diving into the code&lt;/li&gt;
&lt;li&gt;Create a project which others wants to contribute to :)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

&lt;p&gt;Naveen Namani&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>opensource</category>
      <category>github</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Offline documentation of tailwindcss in 5 easy steps</title>
      <dc:creator>naveennamani</dc:creator>
      <pubDate>Sun, 10 Oct 2021 17:20:29 +0000</pubDate>
      <link>https://dev.to/naveennamani/generate-offline-documentation-of-tailwindcss-in-5-minutes-3o79</link>
      <guid>https://dev.to/naveennamani/generate-offline-documentation-of-tailwindcss-in-5-minutes-3o79</guid>
      <description>&lt;p&gt;This post is a 2nd one in the &lt;strong&gt;Offline documentation&lt;/strong&gt; series. If you're new here check out my first post.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/naveennamani/generate-offline-documentation-of-reactjs-in-5-minutes-3h6j"&gt;Generate offline documentation of reactjs in 5 minutes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For more scripts like this, please visit my &lt;a href="https://github.com/naveennamani/offline-docs" rel="noopener noreferrer"&gt;offline-docs&lt;/a&gt; github repo currently contains more than 30 scripts.&lt;/p&gt;

&lt;p&gt;In this post, let's build the offline documentation for &lt;strong&gt;tailwindcss&lt;/strong&gt;, my favorite utility first CSS framework, and my go to CSS framework for rapidly prototyping a design.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting the source code
&lt;/h2&gt;

&lt;p&gt;The documentation for tailwindcss is available on &lt;a href="https://tailwindcss.com" rel="noopener noreferrer"&gt;tailwindcss.com&lt;/a&gt; website. We can easily find the source code for this website on github through a simple google search. It is hosted on github at &lt;a href="https://github.com/tailwindlabs/tailwindcss.com" rel="noopener noreferrer"&gt;https://github.com/tailwindlabs/tailwindcss.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let us first download the source code and inspect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/tailwindlabs/tailwindcss.com
&lt;span class="nb"&gt;cd &lt;/span&gt;tailwindcss.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the code editor of your choice. If using vscode, just enter&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;code &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Understanding the tech stack
&lt;/h2&gt;

&lt;p&gt;If we look at the files in the root directory, we can understand that&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;next.config.js&lt;/code&gt; - The website is written in nextjs&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tailwind.config.js&lt;/code&gt; - The website is build using tailwindcss as the CSS framework (what else you expect?)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;yarn.lock&lt;/code&gt; - using yarn as the package manager&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For understanding the deployment process of nextjs, we can simply go to its corresponding documentation website. You can find the information in below links.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/deployment" rel="noopener noreferrer"&gt;Deployment | Next.js&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/advanced-features/static-html-export" rel="noopener noreferrer"&gt;Advanced features: Static HTML Export | Next.js&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  package.json
&lt;/h2&gt;

&lt;p&gt;Once you gain enough info on how deployment works, let's open &lt;code&gt;package.json&lt;/code&gt; file and see if we have the required scripts already present. Luckily, we have the script &lt;strong&gt;export&lt;/strong&gt; for generating static files. Our life has been made easier already.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpng0zjkky9828kpn9btt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpng0zjkky9828kpn9btt.png" alt="Scripts in package.json file" width="565" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Commands
&lt;/h2&gt;

&lt;p&gt;Now we have enough information to generate the documentation.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install all the dependencies using the &lt;code&gt;yarn&lt;/code&gt; package manager.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the build script using&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn &lt;span class="nb"&gt;export&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;This will generate the required static HTML, js, css and all assets in the &lt;strong&gt;out&lt;/strong&gt; folder.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Serve the documentation generated in &lt;strong&gt;out&lt;/strong&gt; folder&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd out
python -m http.server // simpler
// Or if you prefer nodejs
yarn global add serve
serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Congratulations!&lt;/strong&gt; We now have tailwindcss documentation available offline.&lt;/p&gt;

&lt;p&gt;If you would like to have offline documentation for any framework/library you require, please tell us in the comments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pro tip for vscode users
&lt;/h2&gt;

&lt;h2&gt;
  
  
  jsconfig.json
&lt;/h2&gt;

&lt;p&gt;If you have the following directory structure&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Home
\- components
   |- A.js
   |- B.js

utils
\- utils.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and want to import &lt;code&gt;utils.js&lt;/code&gt; in &lt;code&gt;A.js&lt;/code&gt;, you need to use relative paths as follows&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../../utils/utils.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes it harder to follow the file being imported, and once you have a folder structure 3 or more levels deep, this makes it even harder to write the required imports keeping in mind all the folders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;jsconfig.json&lt;/strong&gt; to the rescue!&lt;/p&gt;

&lt;p&gt;You can use "compilerOptions" &amp;gt; "paths" dictionary to define the path mappings relative to the root of the project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"paths"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"@/utils/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"utils/*"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"@/home/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Home/components/*"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now instead of all those relative paths to import utils, you can simply use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/utils/utils.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to import the utils, and to import &lt;code&gt;A.js&lt;/code&gt; in any other file, we can write&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;A&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/home/A.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see this &lt;code&gt;jsconfig.json&lt;/code&gt; file being used in the &lt;code&gt;tailwindcss.com&lt;/code&gt; project. Go inspect the source code and have fun learning new things.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>documentation</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Generate offline documentation of reactjs in 5 minutes</title>
      <dc:creator>naveennamani</dc:creator>
      <pubDate>Sat, 09 Oct 2021 13:35:27 +0000</pubDate>
      <link>https://dev.to/naveennamani/generate-offline-documentation-of-reactjs-in-5-minutes-3h6j</link>
      <guid>https://dev.to/naveennamani/generate-offline-documentation-of-reactjs-in-5-minutes-3h6j</guid>
      <description>&lt;p&gt;When it comes to learning a new language, framework or library, the first and important source of help comes from the documentation provided by the respective websites. But it is often difficult to go through the complete documentation immediately. And during development we need to refer to the documentation very frequently.&lt;/p&gt;

&lt;p&gt;Having an offline version of the documentation may help to find the information faster and whenever required. Also, it helps to work offline without any distractions from the facebook notifications.&lt;/p&gt;

&lt;p&gt;In this post, let's build the offline documentation for reactjs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting the source code
&lt;/h2&gt;

&lt;p&gt;The documentation for reactjs is available on &lt;a href="https://reactjs.org" rel="noopener noreferrer"&gt;reactjs.org&lt;/a&gt; website. The source code for this website is available as a github repository &lt;a href="https://github.com/reactjs/reactjs.org" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Fireup a cmd, clone this repository and cd into the directory&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

git clone https://github.com/reactjs/reactjs.org
&lt;span class="nb"&gt;cd &lt;/span&gt;reactjs.org


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Open the code editor of your choice. If using vscode, just enter&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

code &lt;span class="nb"&gt;.&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Understanding the tech stack
&lt;/h2&gt;

&lt;p&gt;Once we have the source code, we can see many configuration files there. The most important ones that quickly gives us all the information we need are&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;gatsby-*.js&lt;/code&gt; - these files tells us that &lt;a href="https://www.gatsbyjs.com" rel="noopener noreferrer"&gt;Gatsby&lt;/a&gt; is used for generating the static HTML for the website.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;yarn.lock&lt;/code&gt; - it is using yarn as the package manager.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;vercel.json&lt;/code&gt; - the website is hosted on &lt;a href="https://vercel.com" rel="noopener noreferrer"&gt;vercel&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  package.json
&lt;/h2&gt;

&lt;p&gt;Perhaps, &lt;code&gt;package.json&lt;/code&gt; is the one file that any webdev will start looking at when they start working on a new project. Once we open this file, we can see the dependencies of the projects and the scripts used.&lt;/p&gt;

&lt;p&gt;From the file we can see the following scripts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgp4tckr7h8wfmvhggsj8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgp4tckr7h8wfmvhggsj8.png" alt="Scripts in package.json file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Luckily, we have the &lt;strong&gt;build&lt;/strong&gt; script that we require to build the static HTML.&lt;/p&gt;
&lt;h2&gt;
  
  
  Commands
&lt;/h2&gt;

&lt;p&gt;Now we have enough information to generate the documentation.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install all the dependencies using the &lt;code&gt;yarn&lt;/code&gt; package manager.
```bash
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;yarn install&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Run the build script using
    ```bash


yarn build


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;This will generate the required static HTML, js, css and all assets in the **public** folder.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Serve the documentation generated in &lt;strong&gt;public&lt;/strong&gt; folder
```
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;cd public&lt;br&gt;
python -m http.server // simpler&lt;br&gt;
// Or if you prefer nodejs&lt;br&gt;
yarn add global serve&lt;br&gt;
serve&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
**Congratulations!** We now have reactjs documentation available offline.

If you would like to have offline documentation for any framework/library you require, please tell us in the comments.

Happy coding!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
