1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Create React App+TypeScript+tailwindcssの開発環境構築

Last updated at Posted at 2022-03-14

標記の開発環境構築を試したので作業ログを残す。

確認環境

  • MacBook Pro (16-inch 2019)
  • macOS Monterey 12.0.1
  • Node.js v14.17.1

手順

以下のコマンドを実行する。

# react + TypeScript
npx create-react-app my-app --template typescript
cd my-app

# tailwindcssの導入
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

次にtailwind.config.jsを以下のように書き換える

module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

そして、src/index.cssの一番上にこのコードを挿入。

@tailwind base;
@tailwind components;
@tailwind utilities;

これで完了。

以下のコマンドによりブラウザで実行できる。

npm run start

参考

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?