Skip to content

Tailwind and Rails 7 import-maps? #66

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

Closed
lafeber opened this issue Aug 18, 2021 · 9 comments
Closed

Tailwind and Rails 7 import-maps? #66

lafeber opened this issue Aug 18, 2021 · 9 comments

Comments

@lafeber
Copy link

lafeber commented Aug 18, 2021

How do we make tailwindcss work without webpacker?

@dhh
Copy link
Member

dhh commented Aug 18, 2021

This gem does that?

@dhh dhh closed this as completed Aug 18, 2021
@lafeber
Copy link
Author

lafeber commented Aug 18, 2021

Sorry I meant tailwind with customisations. It says in the README that it's not possible without webpacker though, my bad.

@dhh
Copy link
Member

dhh commented Aug 18, 2021

I don't think I understand? If you want to use Tailwind with Webpacker, you can use the normal Tailwind installation instructions, since you'll be compiling everything yourself.

This gem sidesteps all of that for a simpler, unconfigured version of tailwind.

@ghiculescu
Copy link
Member

@dhh I think the question is, is there a way to customise tailwind without using webpacker?

The super exciting about importmaps is being able to throw webpacker & node.js in the bin, but at the moment that doesn't seem practical if you want to use any Tailwind customisations (eg. @apply, or a custom colour scheme).

@ghiculescu
Copy link
Member

@dhh
Copy link
Member

dhh commented Sep 19, 2021

No TW customization without the whole node rigamarole at the moment, no. I think @apply is better done via Rails helpers, though. That's how we're using this gem at Basecamp. But if you need custom color scheme etc, you will have to compile it yourself for now.

@Merovex
Copy link

Merovex commented Oct 3, 2021

Being able to customize without the whole node rigamarole would be a winning feature. Otherwise, adopting Tailwind struggles against adopting Import Maps. Or, am I missing something?

https://codepen.io/beyondcode/pen/XWMjKLm

@dhh
Copy link
Member

dhh commented Oct 3, 2021

Not in the cards, I'm afraid. But someone could build a web service that could do it! Like a specializing CDN. Have at it 😄

@Merovex
Copy link

Merovex commented Oct 3, 2021

I got it to work using this (granted not for prod):

https://github.com/tailwindlabs/tailwindcss/releases/tag/v3.0.0-alpha.1

<%# stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
<script src="https://cdn-tailwindcss.vercel.app/"></script>
    <script>
      tailwind.config = {
        theme: {
          extend: {
            colors: {
              red: {
                50: '#e0c1b6',
                100: "#e5dad7",
                200: "#cbb5ae",
                300: "#b09186",
                400: "#966c5d",
                500: "#7c4735",
                600: "#63392a",
                700: "#4a2b20",
                800: "#321c15",
                900: "#190e0b"
              }
            }
          },
        },
      }
    </script>

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

No branches or pull requests

4 participants