11
3

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.

TailwindCSSを使っているとKaminariのテンプレートが生成されない

Last updated at Posted at 2022-06-06

起こったこと

Rails7でアプリを作っているときに、TailwindCSSを使っていると、KaminariのREADMEにあるコマンド(rails g kaminari:views default)でテンプレートが生成されなかった。(エラーも出ない😢)

$ rails g kaminari:views default
$
$ ls app/views
active_storage  users  layouts  shared   #<= kaminariフォルダがない

ちなみに、何かthemeを指定すると、tailwindでは使えないよと言われてしまう。

$ bin/rails g kaminari:views google
template_engine: tailwindcss is not available for theme: google

公式README: https://github.com/kaminari/kaminari#customizing-the-pagination-helper

To Edit Your Paginator
Run the generator first,
% rails g kaminari:views default
then edit the partials in your app's app/views/kaminari/ directory.

起こった環境

  • Rails 7.0.3
  • TailwindCSS
  • Kaminari 1.2.2

対応方法

テンプレートエンジンの指定が必要らしい。バグっぽい?のでそのうち直るかもしれない :thought_balloon:

rails g kaminari:views default -e erb

refs: https://github.com/kaminari/kaminari/issues/1071#issuecomment-1016004825

11
3
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
11
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?