-
Notifications
You must be signed in to change notification settings - Fork 173
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
Using images from the asset pipeline #137
Comments
|
Awesome! I'll definitely answer the StackOverflow question with the solution. Do you think this should also be documented in the README of this project? Or is this something that will eventually be 'standard practice'? |
I'd be happy seeing a note in the README about it 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be useful for a Tailwind + Rails integration to include a way to use images from the asset pipeline. As far as I know it's not possible to use
asset-url
in any of the locations relevant to tailwind:application.tailwind.css
as a custom utility: This half-works, asasset-url
is put in thetailwind.css
output file. However, the asset pipeline ignores it because it isn't processed. Maybe I can enable this somehow?I feel like 1. should be the 'intended' solution. However, I don't have enough knowledge of neither Rails nor the asset pipeline to write a PR for this. If someone provides me with pointers I can try creating a PR that makes it work.
There are two workarounds. The first is putting your images in the
public/assets
folder. However that means throwing away the advantages of the asset pipeline, including fingerprinting of the images allowing long cache times. The second is maintaining a separate CSS file that is solely responsible for images. That's not ideal, because it's confusing why you would have two CSS outputs even though you're using Tailwind. And you can't use Tailwind'safter:
,before:
,hover:
, etc.StackOverflow question asking the same thing: https://stackoverflow.com/questions/66842651/inserting-a-background-image-from-asset-pipeline-with-tailwind.
The text was updated successfully, but these errors were encountered: