Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwindとsassc-railsの非互換問題を解決。 #46

Merged
merged 5 commits into from
Sep 9, 2022

Conversation

lei900
Copy link
Collaborator

@lei900 lei900 commented Sep 7, 2022

概要

Tailwindとsassc-railsの非互換問題を解決。

背景

Tailwindが最新のcss構文を使っているが、SASSが最新のCSS構文を理解できていないため、gem 'sassc-rail'アンインストール必要;一方はrails-adminはまだsaccに依存しているので、sassc-rail保留必要

解決方法

css compressorはsassでなく、別のモダンなcompressorCSSOを使用

  1. Install csso-cli. yarn add csso-cli
  2. カスタムcompressor作成config/initializers/csso.rb
  3. デフォルトのCSS compressorを:cssoに設定
    config.assets.css_compressor = :csso (production環境とtest環境両方必要)
  4. Github Actionsのjob stepにbundle exec rake assets:precompile追加

確認方法

Github Actionsの実行結果がグリンになっている
https://github.com/Kei5665/tokyo_senkyo_matching/actions/runs/3005081206

#45

参照:
rails/tailwindcss-rails#82 (comment)
rails/tailwindcss-rails#153 (comment)
railsadminteam/rails_admin#3450

@lei900 lei900 added the bug Something isn't working label Sep 7, 2022
@lei900 lei900 self-assigned this Sep 7, 2022
@lei900 lei900 changed the base branch from main to develop September 7, 2022 04:53
@lei900 lei900 changed the title Tailwind precomplieエラー解決 Tailwindとsassc-railsの非交換問題を解決。 Sep 7, 2022
@lei900 lei900 changed the title Tailwindとsassc-railsの非交換問題を解決。 Tailwindとsassc-railsの非互換問題を解決。 Sep 7, 2022
@Kei5665 Kei5665 self-requested a review September 8, 2022 19:02
Copy link
Owner

@Kei5665 Kei5665 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tailwindcss-railsを入れてもプリコンパイルでエラーになっちゃうんですね〜
テストが通るならこれで良いと思います〜!

@lei900 lei900 merged commit 48cba33 into develop Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants