https://avo.cool logo
Hello again I'm now wanting to use additional ...
# avo-2
m
Thread automatically created by andrew.walker.testdouble.com in #740893011994738751
l
The only thing I did differently from the instructions was put
--minify
inside of the quotes in
package.json
.
bin/rails generate avo:tailwindcss:install
said to use
"scripts": { "avo:tailwindcss": "tailwindcss -i ./app/assets/stylesheets/avo.tailwind.css -o ./app/assets/builds/avo.tailwind.css -c ./config/tailwind.config.js" --minify }
but that didn't look right. Anyhoo - I'm confused as the linked files appear to have different paths.
manifest.js
Copy code
javascript
//= link_tree ../images
//= link_directory ../stylesheets .css
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
//= link_tree ../builds
^ I've noticed that the last line here is being added when I run
bin/rails generate avo:tailwindcss:install
. Removing prevents this error but then my tailwind classes don't seem to be working.
l
hei @late-noon-56486 check this issue, may apply to your situation https://github.com/rails/jsbundling-rails/issues/56#issuecomment-985985939
let me know if the issue persists
l
Ok. I got it working by renaming
app/assets/stylesheets/avo.tailwind.css
to
app/assets/stylesheets/care.tailwind.css
and then setting
-i ./app/assets/stylesheets/care.tailwind.css
in
package.json
The problem comes from how the input file and output file had the same name (
avo.tailwind.css
) and that
manifest.js
is set up to link both paths:
Copy code
//= link_directory ../stylesheets .css
...
//= link_tree ../builds
I wonder if this is a bug in Avo or perhaps the docs?
manifest.js
was fully auto-generated by Rails+Avo
I also had to add
'./app/components/**/*.{erb,haml,html,slim}'
to the list of
content
in
tailwind.config.js
. I wonder if that's worth adding to the docs too...
Anyhoo. It's working and I appreciate the help. I'm happy to contribute to Avo and docs but just not sure if I should be making said changes.
l
Not sure also, some of this kind of "bugs" depends of the parent app configurations
I'm glad that works! About the content added to tailwind config also depends on what each app want to include
From what I've seen, during tailwind integration each app can face different issues
I didn't faced any of this issues during the process on a dummy app
l
I'm thinking we could make it default to using a different name for the input and output file. This shouldn't break any functionality while also preventing other people from running into the same issue we have. I wish we knew how we landed with this config to know if this is some sort of weird edge case. Based on the git history for
manifest.js
, it's only ever been touched by the
initial commit
and this stuff with custom asset pipeline. I don't know what options/flags etc were used to set up the Rails app but I don't imagine they were anything too out of the ordinary.
l
@late-noon-56486 your
manifest.js
already had the
//= link_directory ../stylesheets .css
line and on the process you included the
//= link_tree ../builds
?
l
Before running
bin/rails generate avo:tailwindcss:install
the
manifest.js
looked like:
Copy code
javascript
//= link_tree ../images
//= link_directory ../stylesheets .css
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
After running it looked like:
Copy code
javascript
//= link_tree ../images
//= link_directory ../stylesheets .css
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
//= link_tree ../builds
Is it unusual to put something like
//= link_directory ../stylesheets .css
or
//= link_tree ../stylesheets .css
in a
manifest.js
?
You added
//= link_tree ../builds
manually right?
What DHH say on the issue that I send is
Normally if you use builds/application.js you don't also need app/assets/javascripts/application.js.
i think it appyes to css too, i.e. if you link the build you dont need to also link the stylesheets directory
I think maybe we should add a warning about this on docs for folks that have
//= link_directory ../stylesheets .css
on the manifest
l
I think that would help. That or avoid the conflict by naming the files differently:
Copy code
bash
tailwindcss\
  -i ./app/assets/stylesheets/input.tailwind.css\
  -o ./app/assets/builds/output.tailwind.css\
  -c ./config/tailwind.config.js --minify
l
or avoid the conflict by naming the files differently
This mean that both,
input.tailwind.css
and
output.tailwind.css
will end up linked on manifest file right? But since they have different names
Sprockets::DoubleLinkError
will not be raised. My question is: Is correct to link both? Can this generate some conflicts or is safe? IMHO only
output.tailwind.css
should be linked
WDYT?
l
//= link_tree ../builds
was added by running
bin/rails generate avo:tailwindcss:install
. It was not added manually.
I agree that the input file shouldn't be linked. Only the output file.
I'm not super familiar with Rails norms. So I don't know if it's common practice to link the stylesheets directory. If it is common, then I would suggest putting the input file somewhere else.