2
2

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.

【多分暫定対応】M1 macのDocker上のRails 7でTailwind CSS 3を使う

Posted at

Rails 7では、--css tailwindオプションをつけるとtailwindcss-railsを通じて、Tailwind CSS 3が使えるようになります。

しかし、ややこしい経緯によりARM Linuxの上では使えないので、npmからTailwind CSS 3をインストールして使う必要があります。

まずは、npm install tailwindcssをしてインストールします。

そしてRakefileの最後に下記のように書き加えてください。

# use Tailwind CSS 3 on npm
original_verbose = $VERBOSE
$VERBOSE = nil # suppress warnings
TAILWIND_COMPILE_COMMAND = "#{Pathname.new(__dir__).to_s}/node_modules/.bin/tailwindcss -i #{Rails.root.join("app/assets/stylesheets/application.tailwind.css")} -o #{Rails.root.join("app/assets/builds/tailwind.css")} -c #{Rails.root.join("config/tailwind.config.js")}"
$VERBOSE = original_verbose

これをしない場合には下記のようなエラーが出ます。

ERROR: tailwindcss-rails does not support the aarch64-linux platform
Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
2
2
0

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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?