<?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: Annoske</title>
    <description>The latest articles on DEV Community by Annoske (@annoske2).</description>
    <link>https://dev.to/annoske2</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%2F589660%2F245012a3-3d19-40bf-98d8-c240d900aa65.jpg</url>
      <title>DEV Community: Annoske</title>
      <link>https://dev.to/annoske2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/annoske2"/>
    <language>en</language>
    <item>
      <title>How to use Tailwindcss in React.</title>
      <dc:creator>Annoske</dc:creator>
      <pubDate>Sun, 07 Mar 2021 04:51:44 +0000</pubDate>
      <link>https://dev.to/annoske2/how-to-use-tailwindcss-in-react-4pff</link>
      <guid>https://dev.to/annoske2/how-to-use-tailwindcss-in-react-4pff</guid>
      <description>&lt;h2&gt;
  
  
  About this Article
&lt;/h2&gt;

&lt;p&gt;This is an article about using taillwind in react.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Tailwind?
&lt;/h2&gt;

&lt;p&gt;Tailwind is a CSS flamework.&lt;br&gt;
As show below, you can add class to element,and adopt style.&lt;br&gt;
&lt;a href="https://tailwindcss.com/"&gt;https://tailwindcss.com/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TraXiP5Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/502798/fc45e921-3a98-0de4-ae6f-3605445134e3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TraXiP5Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/502798/fc45e921-3a98-0de4-ae6f-3605445134e3.gif" alt="screen.gif"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How to install
&lt;/h2&gt;
&lt;h3&gt;
  
  
  installing package
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
&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;npm install postcss-cli autoprefixer --save-dev
or
yarn add postcss-cli autoprefixer --save-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  create styles.css
&lt;/h3&gt;

&lt;p&gt;Create style.css and import @tailwind property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@tailwind base;

@tailwind components;

@tailwind utilities;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add script command to build Tailwind in package.json.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
    "start": "react-scripts start",
    "build:tailwind":"tailwind build src/styles.css -o src/tailwind.css",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And run below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run-script build:tailwind
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then,tailwind.css will be created.&lt;/p&gt;

&lt;h3&gt;
  
  
  import tailwind.css
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import './tailwind.css';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Check importing.
&lt;/h2&gt;

&lt;p&gt;If you write the following,you can confirm tailwind.css&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";

function App() {
  return (
    &amp;lt;div className="App"&amp;gt;
      &amp;lt;div class="max-w-sm rounded overflow-hidden shadow-lg"&amp;gt;
        &amp;lt;img
          class="w-full"
          src="https://source.unsplash.com/random/1600x900/"
          alt="Sunset in the mountains"
        &amp;gt;&amp;lt;/img&amp;gt;
        &amp;lt;div class="px-6 py-4"&amp;gt;
          &amp;lt;div class="font-bold text-xl mb-2"&amp;gt;The Coldest Sunset&amp;lt;/div&amp;gt;
          &amp;lt;p class="text-gray-700 text-base"&amp;gt;
            Lorem ipsum dolor sit amet, consectetur adipisicing elit.
            Voluptatibus quia, nulla! Maiores et perferendis eaque,
            exercitationem praesentium nihil.
          &amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="px-6 py-4"&amp;gt;
          &amp;lt;span class="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2"&amp;gt;
            #photography
          &amp;lt;/span&amp;gt;
          &amp;lt;span class="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2"&amp;gt;
            #travel
          &amp;lt;/span&amp;gt;
          &amp;lt;span class="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700"&amp;gt;
            #winter
          &amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is as follows.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3UIY_oZH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/502798/61a3e193-9c4a-7e92-12c5-2a6cb657f4a1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3UIY_oZH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/502798/61a3e193-9c4a-7e92-12c5-2a6cb657f4a1.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  参考記事
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://blog.logrocket.com/create-react-app-and-tailwindcss/"&gt;https://blog.logrocket.com/create-react-app-and-tailwindcss/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
