Skip to content

Conversation

rip747
Copy link

@rip747 rip747 commented Oct 2, 2024

On a newly generated 8.0.0.beta1 app it seems that the tailwind.css is referenced twice with the head of the generated layout

<link rel="stylesheet" href="/assets/tailwind-aaa98186.css" data-turbo-track="reload" />
<link rel="stylesheet" href="/assets/inter-font-1d90a608.css" data-turbo-track="reload" />
<link rel="stylesheet" href="/assets/application-8b441ae0.css" data-turbo-track="reload" />
<link rel="stylesheet" href="/assets/application.tailwind-bb2039bf.css" data-turbo-track="reload" />
<link rel="stylesheet" href="/assets/tailwind-aaa98186.css" data-turbo-track="reload" />

it seems that the injected stylesheet_link_tag is including the tailwind stylesheet

<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>

it is automatically included from the 'app' stylesheet call from the app/build directory

<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>

removing the tailwind reference

<%= stylesheet_link_tag "inter-font", "data-turbo-track": "reload" %>

prevents the duplicate in the generated layout

<link rel="stylesheet" href="/assets/inter-font-1d90a608.css" data-turbo-track="reload" />
<link rel="stylesheet" href="/assets/application-8b441ae0.css" data-turbo-track="reload" />
<link rel="stylesheet" href="/assets/application.tailwind-bb2039bf.css" data-turbo-track="reload" />
<link rel="stylesheet" href="/assets/tailwind-aaa98186.css" data-turbo-track="reload" />

Copy link

@brunoprietog brunoprietog left a comment

Choose a reason for hiding this comment

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

I think this is not the way to go, since :app will try to load all the css that must pass through the Tailwind transpiler in its pure state on each page, something that only works if you use only vanilla CSS. What we really need to do is to remove those 2 default lines in Rails 8 so that the only entry point is the Tailwind build.

@flavorjones
Copy link
Member

@rip747 This change fails the tests in CI for the reasons @brunoprietog mentions. I'm going to close this, but please feel free to ask questions and if you feel like it propose a change upstream in Rails.

@flavorjones
Copy link
Member

I've drafted a pull request that I think fixes this issue at #473

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants