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

[admin] Provide a pre-built CSS file and a script to customize TW for local modifications #5554

Merged
merged 3 commits into from
Dec 19, 2023

Conversation

elia
Copy link
Member

@elia elia commented Dec 18, 2023

Summary

With this PR the new admin will work out of the box without the need for running TW in the host app in order to generate the first instance of the application CSS code.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@elia elia self-assigned this Dec 18, 2023
@github-actions github-actions bot added changelog:solidus_core Changes to the solidus_core gem changelog:repository Changes to the repository not within any gem changelog:solidus_admin labels Dec 18, 2023
@elia elia force-pushed the elia/admin/tailwind branch 4 times, most recently from 542a111 to e1b4edf Compare December 18, 2023 16:42
@elia elia marked this pull request as ready for review December 18, 2023 16:56
@elia elia requested a review from a team as a code owner December 18, 2023 16:56
@elia elia requested a review from rainerdema December 18, 2023 16:56
@kennyadsl
Copy link
Member

@elia nice, can you tell a bit about why we are doing this change? Also curious about how this works with other extensions that might have tailwind classes in their admin-related templates.

@elia
Copy link
Member Author

elia commented Dec 18, 2023

@elia nice, can you tell a bit about why we are doing this change? Also curious about how this works with other extensions that might have tailwind classes in their admin-related templates.

The main reason is to allow for straightforward experience installing the admin, for extensions there are a few options, we expect in most cases that extensions will be able to reuse existing components. In case the extension will really need to provide additional components it will require just an updated list of content paths on the tailwind configuration.

There's also an experimental JIT mode that is used for the CDN version of TW that wouldn't require compilation at all, but that's a sort of extreme solution, although it would be completely no-build.

This configuration is a vanilla TW build removing the need for
temporary files and ERB tags. Also relegates the dependency on
tailwindcss-rails only to the development of the gem itself.

By relying on a known target path for the build it will be easy to
setup a local TW build that will override that path in the host Rails
application, leaving the implementors free to go with whatever JS/CSS
builder they want.
@elia elia force-pushed the elia/admin/tailwind branch from e1b4edf to 3e977fb Compare December 19, 2023 09:43
@kennyadsl
Copy link
Member

Just to be sure to understand how this works, what if I change a tailwind class in a template and commit to the repo without rebuilding the admin? Would that change the tailwind pre-built file on the next person pulling the repo and starting the server?

@elia
Copy link
Member Author

elia commented Dec 19, 2023

@kennyadsl I had the same concern 💯, so the pre-built script is not tracked in the solidus repo, but is built just before creating the .gem file and added to the gem bundle.

elia added 2 commits December 19, 2023 16:29
We're not writing application code in which it's ok to assume that all
tasks should load the environment first.
@elia elia force-pushed the elia/admin/tailwind branch from 3e977fb to 7dc3b14 Compare December 19, 2023 15:29
@elia elia merged commit b3878ef into main Dec 19, 2023
8 checks passed
@elia elia deleted the elia/admin/tailwind branch December 19, 2023 15:57
@elia elia removed the changelog:solidus_core Changes to the solidus_core gem label Dec 21, 2023
@tvdeyen
Copy link
Member

tvdeyen commented Jan 16, 2024

@elia see #5598 . It would be nice if this would also work in the sandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:repository Changes to the repository not within any gem changelog:solidus_admin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants