Comments (10)
Perhaps that was true in the past, but it seems like the gem supports both Sprockets and Webpacker today.
As per README:
Tailwind CSS for Rails works with both the asset pipeline and Webpacker.
The install generator checks whether the app uses Sprockets or Webpacker:
https://github.com/rails/tailwindcss-rails/blob/main/lib/tasks/tailwindcss_tasks.rake#L3-L9
https://github.com/rails/tailwindcss-rails/blob/main/lib/tasks/tailwindcss_tasks.rake#L17-L20
Please reopen. Thanks!
from tailwindcss-rails.
I think we should remove the webpack installer. This heart of this gem is a sprockets-specific approach to using TW with the asset pipeline. Let's just go with that.
Re: @apply, yes, I agree, would be nice to have a a sprockets version of this.
from tailwindcss-rails.
Confirmed. After I've uncommented require "sprockets/railtie"
in config/application.rb
, the installation succeeded.
from tailwindcss-rails.
Hi @vfonic.
Unfortunately, that error is unrelated to the Tailwind CSS Nova extension, but instead is related to the tailwindcss-rails gem. If you submit an issue there, hopefully someone should be able to help. The Tailwind CSS Nova extension in no way relies on Sprockets.
Good luck!
Thanks,
Jason
from tailwindcss-rails.
This gem is designed to be used exclusively with the asset pipeline. It has no relevance for a Webpacker setup. You can just install Tailwind as normal for that.
from tailwindcss-rails.
Lol, yes, forgot we added that. Not sure itβs a good idea to have dual purpose like this, though.
from tailwindcss-rails.
I understand. It's a tough call to make. I'd argue that, since the introduction of Webpacker, many gems have opted for the dual purpose/support. It's just the way things are now. I think having dual support makes more sense than having to maintain two separate gems that could have a lot of shared functionality (things like: purger, compressor, etc.)
from tailwindcss-rails.
Tailwind packed through Webpack has all those functions natively. This gem specifically implements those functions via Ruby for the asset pipeline. And then offers a slim, probably too-confusing wrapper on installing TW for Webpack.
from tailwindcss-rails.
@dhh I could do two things:
- Fix this issue and continue to support webpack
- Drop webpack support
I agree with your point that easiest way forward would be to just support asset pipeline and have one north star. Fix would include conditionals inside the engine.rb
(or somekind of conditionals :))
require "tailwindcss/compressor" if defined?(Sprockets) # maybe also here
module Tailwindcss
class Engine < ::Rails::Engine
if defined?(Sprockets)
...
end
end
end
That being said I'm not gonna lie, spined-up numerous webpacker apps and this generator was helpful, but... :)
Main issue to use TW with asset pipeline is inability to use @apply
out of the box. Every TW production app that I've worked with used @apply
to extract common components such as button
. Using @apply
is maybe anti-pattern if we look at the TW idea, but without it some kind of componentization(view_component
,partials
) would be "necessary"
from tailwindcss-rails.
This is "fixed" here #64
from tailwindcss-rails.
Related Issues (20)
- tailwindcss:watch terminates with exception HOT 10
- uninitialized constant Tailwindcss (NameError) when launching puma HOT 16
- Watcher not working in Docker even with `tty:true` HOT 2
- How do I get the color palette from the tailwind docs to work? HOT 1
- Allow to choose between Procfile.dev or Puma plugin
- Classes not loaded while building
- TailwindCSS does not support react-on-rails with scss HOT 1
- Run bin/dev, but it failed to install foreman HOT 6
- Not working on x86 architecture
- Rails underscore escaping issues HOT 2
- Tailwind scaffold template is out of sync with rails/rails ERB scaffold template HOT 2
- May be time to remove @tailwindcss/aspect-ratio HOT 4
- Debugger hangs when I use the watcher as plugin! HOT 2
- bin/dev doesn't work for me. HOT 3
- Automate gem build and deployment with github actions HOT 2
- Investigate failing CI build
- Use of gem without sprockets (eg vite) aka standalone use of tailwind generators HOT 1
- Installing Tailwind into an existing project HOT 2
- Form Helpers & Tailwind
- "rebuild" speed is extremely slow when using safelist
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tailwindcss-rails.