avatarS M Mamunur Rahman

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

2713

Abstract

Files</h1><p id="aea6">We need to add a <code>tailwind.config.js</code> and a <code>postcss.config.js</code> file to the root of our application. Use the following command to set this up:</p><div id="ee16"><pre>npx tailwindcss <span class="hljs-keyword">init</span> -p</pre></div><p id="414e">This will create a <code>tailwind.config.js</code> file at the root of your project:</p> <figure id="59e0"> <div> <div>

            <iframe class="gist-iframe" src="/gist/BetterProgramming/5f1fc501fe510339576a69bd5936c2b1.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
          </div>
        </div>
    </figure></iframe></div></div></figure><p id="21b1">Learn more about configuring Tailwind in the <a href="https://tailwindcss.com/docs/configuration">configuration documentation</a>.</p><p id="374c">It will also create a <code>postcss.config.js</code> file that includes <code>tailwindcss</code> and <code>autoprefixer</code> configured:</p>
    <figure id="5464">
        <div>
          <div>
            
            <iframe class="gist-iframe" src="/gist/BetterProgramming/373cad919a6f591df7649efec7dcce78.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
          </div>
        </div>
    </figure></iframe></div></div></figure><h1 id="d634">Import the CSS</h1><p id="07d3">Let’s create a <code>styles</code> folder and import Tailwind CSS from a CSS file:</p><div id="236d"><pre><span class="hljs-built_in">touch</span> styles/tailwind.css</pre></div><p id="79bb">Inside <code>tailwind.css</code>:</p><div id="33c2"><pre><span class="hljs-variable">@tailwind</span> base;

<span class="hljs-variable">@tailwind</span> components; <span class="hljs-variable">@tailwind</span> utilities;</pre></div><p id="5160">To add global CSS to a Next.js app, we need to override the default <code>App</code> component. With Next.js 10, you should already have <code>_app.js</code> inside your pages folder. Now import the stylesheet we created:</p><div id="da6f"><pre><span class="hljs-function"><span class="hljs-title">import</span></span> <span class="hljs-string">'../styles/globals.css'</span> <span class="hljs-function"><span class="hljs-title">import</span></span> <span class="hljs-string">'../styles/tailwind.css'</span>;</pre></div><div id="c873"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">MyApp</span>(<span class="hljs-params">{ Component, pageProps }</span>) { <span class="hljs-keyword">return</span> <span class="language-xm

Options

l"><span class="hljs-tag"><<span class="hljs-name">Component</span> {<span class="hljs-attr">...pageProps</span>} /></span></span>; }</pre></div><p id="cd5c">Cool, now we are ready to add some Tailwind CSS magic to our home page. Go to <code>/pages/index.js</code> (or <code>/pages/index.tsx</code> if you use TypeScript) and add some elements with Tailwind CSS classes. For example:</p> <figure id="7022"> <div> <div>

            <iframe class="gist-iframe" src="/gist/BetterProgramming/5d768ccc213a3d4eeff44d3955cebd3d.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
          </div>
        </div>
    </figure></iframe></div></div></figure><p id="12b1">Run <code>yarn dev</code> to see your app on <a href="https://localhost:4202/settings/departments">http://localhost:3000</a> in your browser.</p><h1 id="996b">Configure PurgeCSS</h1><p id="d1b6">One problem with Tailwind CSS is the large file size, but <a href="https://github.com/FullHuman/purgecss">PurgeCSS</a> can fix this. PurgeCSS reduces the file size by scanning your HTML and removing any classes that aren’t used. We only want this in production because if we are developing, we want to be able to use any Tailwind CSS class without running the build process.</p><p id="a37c">Now with Tailwind CSS v2, PurgeCSS is already included. All you have to do is update the <code>tailwind.config.js</code> file so Tailwind can tree-shake unused styles in production builds. Update your file like this:</p>
    <figure id="c01b">
        <div>
          <div>
            
            <iframe class="gist-iframe" src="/gist/BetterProgramming/4fe51a3e9e7f33b4e647ffee294f8cdb.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
          </div>
        </div>
    </figure></iframe></div></div></figure><p id="2dad">For now, we check all of our code inside <code>.js, .jsx, .ts or .tsx</code> files that live in either the <code>pages/</code> or <code>components/</code> folder. If you plan to add HTML in other folders like <code>containers/</code> or something, make sure you add that folder to this configuration file.</p><p id="29a2">You can read the guide from Tailwind on <a href="https://tailwindcss.com/docs/optimizing-for-production">optimizing for production</a> to learn more about tree-shaking unused styles for best performance.</p><h1 id="6371">Conclusion</h1><p id="fafc">Now we are ready to work with the latest versions of Next.js and Tailwind CSS without having to worry about bundle sizes!</p><p id="fdfe">That’s it! Thanks for reading. I hope it was helpful.</p></article></body>

Confucius and His Teachings

A Chinese philosopher and politician from 551 BC

Image by Peggy und Marco Lachmann-Anke from Pixabay

The man who asks a question is a fool for a minute, the man who does not ask is a fool for life. — Confucius

Who is Confucius?

Confucius is a Chinese philosopher and politician born in a cave near Qufu (Shandong province, China) in 551BC. He is better known in China as Master Kong.

The life of Confucius is mysterious, as we don’t know much about him and the events of his life. There is no first-hand evidence of his writing as well. All we have is a book, The Analects, where his teachings, sayings, and ideas are compiled and written by his followers.

The Analects of Confucius

This book is a compilation of the thoughts, ideas, and teachings of Confucius written and compiled by his followers.

It is believed that The Analects of Confucius was written during the Warring States period (475–221 BC) and came into its final shape during the mid-Han dynasty (206 BC–220 AD).

The Analects of Confucius has a tremendous influence on today’s Chinese and East-Asian thoughts and values. It has also been one of the most widely-read and studied books in China for the last 2,000 years.

Image by Levi Fraser from Pixabay

Wheresoever you go, go with all your heart. — Confucius

Confucianism

Confucius never claimed him as an innovator, as he said, his teachings are the rediscoveries of the truth of the past. The philosophy of Confucius is known as Confucianism. Many modern scholars now prefer to call it Ruism.

It is a worldview on politics, education, and ethics taught by Confucius and his followers in the 5th and 6th centuries BC. Though Confucianism is not an organized religion, it gives guidance for social connections, love for humanity, self-discipline, and rituals.

During the first Han-dynasty (2nd century BC), Confucianism became the foundation of the state ideology of China.

Even today, Confucius is widely considered as one of the greatest thinkers of Chinese history as his ideas and thoughts influenced many countries, including Japan, Korea, and Vietnam.

Photo by 郑 无忌 on Unsplash

Teachings of Confucius

Confucius says the ultimate goal is to become a man of virtue or junzi, achieving through proper education.

The key concepts for virtue, as Confucius says, are ren and li. The ren means compassion for others and li means rituals, the proper forms, and ceremonies of conduct.

He says — “without ritual, courtesy is tiresome, prudence is timid; without ritual, bravery is quarrelsome, frankness is hurtful. Every person, according to him, has a prescribed place and must behave accordingly”.

His teachings focused on two interrelated areas; social teachings and political teachings.

Social Teachings

The social teachings focus on the proper behavior of an individual to his fellow men and society.

Confucius viewed education as the core to achieve proper conduct. According to his teachings, people should have compassion for one another and avoid treating others in ways that they would not wish to be treated.

Confucius viewed adherence to correct rituals as the key to achieving proper self-mastery. These rituals encompassed both quasi-religious practices, including the veneration of dead ancestors, as well as the broader concept of etiquette and correct social interaction between husband and wife, parents and children, brothers and sisters, etc.

Confucius prescribed a complex set of rituals, including clapping (on joyous occasion), marriage, mourning rites, sacrifices, feasts, etc.

He believed that developing a harmonious relationship through proper conduct is the foundation for establishing a just and stable society.

Political Teachings

Confucius’ political teachings focus on the guidance for rulers; how they should rule, and act as a governing entity.

He put great emphasis on justice, believing that the key to good governance lay in each man carrying out his duties as prescribed by his position within the hierarchy.

Confucius considered virtue as a great attribute of rulers. He believed that rulers should not have to resort to force or the threat of punishment to maintain power. He stated — your job is to govern, not to kill.

He also believed that rulers should observe proper rituals to maintain their position and right to rule.

Photo by DAN MA on Unsplash

A Few Thoughtful Quotes from Confucius

Let’s see a few wonderful quotes from Confucius that reflect his teachings and deep thoughts.

1

Before you embark on a journey of revenge, dig two graves.

2

He who knows all the answers has not been asked all the questions.

3

The man who moves a mountain begins by carrying away small stones.

4

The funniest people are the saddest ones

5

Everything has beauty, but not everyone sees it.

Photo by Hans Vivek on Unsplash

6

It does not matter how slowly you go as long as you do not stop.

7

Silence is a true friend who never betrays.

8

Give a bowl of rice to a man and you will feed him for a day. Teach him how to grow his own rice and you will save his life.

9

The man of wisdom is never of two minds; the man of benevolence never worries; the man of courage is never afraid.

10

If what one has to say is not better than silence, then one should keep silent.

In China, even in this modern time, you will see the influence of Confucius. Due to the legacy of his teachings and thoughts, Chinese people still value their family, the elderly, and exhibit polite and correct behavior in public.

No doubt, Confucius has a substantial influence on the Chinese way of life.

I believe, like Confucius, all great thinkers of the past can teach us something new, something significant that may help us to make our life more meaningful.

Thank you for reading.

If you are interested in great thinkers' life and teachings, you may find the following post helpful too.

Philosophy
Confucius
China
Life Lessons
Life
Recommended from ReadMedium