wide-art-99889
05/23/2023, 4:36 PMlg:max-h-[500px]
to constrain the height of an element. This works fine in my local development environment, but when I deploy to a heroku app the height constraint is not applied (I can see the tailwind class in the markup). I have tried the following steps to get it to work:
1. I added ./app/components/**/*.rb
and ./app/components/**/*.html.erb
to the content
section of my tailwind.config.js
file.
2. I added a safelist
section to the same file with an entry for lg:max-h-[500px]
Neither of these steps appears to fix the problem. Do I also need to run bin/rails avo:build-assets
as part of my heroku deploy process to get this to work?wide-art-99889
05/23/2023, 4:41 PMyarn avo:tailwindcss
on deploy, so I'll add that to the heroku deploy process.wide-art-99889
05/23/2023, 5:01 PMavo:tailwindcss
script entry to my package.json file.wide-art-99889
05/23/2023, 5:16 PM@media (min-width:1024px){.lg\:max-h-500{max-height:500px}}
This looks like what I want, but I'm not sure if this file is being referenced by the pagewide-art-99889
05/23/2023, 5:21 PMlg:max-h-[500px]
) with a theme extension so that it's no longer ad-hoc. I added the following to my tailwind.config.js:
```
theme: {
extend: {
maxHeight: {
'500': '500px'
}
}
}
then I changed the class I used to lg:max-h-500
in my component html.erb file.wide-art-99889
05/23/2023, 5:22 PMwide-art-99889
05/23/2023, 6:18 PMconfig
instead of in the project root.
I kept noticing that running the yarn task would say "no utility classes found in your contents" which I thought was weird. Eventually I got the suspicion that yarn avo:tailwindcss
was not reading the tailwind.config.js
file. I confirmed this by modifying the yarn scripts
entry to include -c ./config/tailwind.config.js
. This caused the custom utility class to start working locally!wide-art-99889
05/23/2023, 6:18 PMwide-art-99889
05/23/2023, 6:42 PMwide-art-99889
05/23/2023, 6:47 PMtailwind.config.js
file in my project, but I think I need another change to get that command to execute as part of the heroku build process.wide-art-99889
05/23/2023, 7:16 PMavo.tailwind-foobar.css
in development has all of the required tailwind style information, where the file avo.tailwind.css
on my heroku site has the untouched source like @tailwind base;
. This makes me think it's not being parsed by tailwindcss
.lemon-wall-20836
05/23/2023, 8:11 PMlemon-wall-20836
05/23/2023, 8:12 PMlemon-wall-20836
05/23/2023, 8:12 PMwide-art-99889
05/23/2023, 8:40 PMlemon-wall-20836
05/23/2023, 8:40 PMlemon-wall-20836
05/23/2023, 8:40 PMruby
Rake::Task["db:migrate"].enhance do
`yarn`
`yarn avo:tailwindcss`
end
wide-art-99889
05/23/2023, 8:41 PMwide-art-99889
05/23/2023, 8:41 PMlemon-wall-20836
05/23/2023, 8:41 PMlemon-wall-20836
05/23/2023, 8:41 PMyarn
toolemon-wall-20836
05/23/2023, 8:42 PMlemon-wall-20836
05/23/2023, 8:42 PMwide-art-99889
05/23/2023, 8:44 PMrelease
line to add && yarn avo:tailwindcss
. I think that since this runs after the slug has been created, it may not have the intended effect.wide-art-99889
05/23/2023, 8:44 PMassets:precompile
rake task instead.lemon-wall-20836
05/23/2023, 8:44 PMwide-art-99889
05/23/2023, 8:59 PMwide-art-99889
05/23/2023, 8:59 PMwide-art-99889
05/23/2023, 8:59 PMlemon-wall-20836
05/23/2023, 8:59 PMapp/assets/builds
) and that it's loaded onto the page?wide-art-99889
05/23/2023, 9:01 PMavo.tailwind.css
that is linked from the page it looks like this:
@tailwind base;
@tailwind components;
@tailwind utilities;
/*
@layer components {
.btn-primary {
@apply py-2 px-4 bg-blue-200;
}
}
*/
wide-art-99889
05/23/2023, 9:01 PMlemon-wall-20836
05/23/2023, 9:01 PMtailwindcss.config.js
file?lemon-wall-20836
05/23/2023, 9:02 PMlemon-wall-20836
05/23/2023, 9:02 PMlemon-wall-20836
05/23/2023, 9:02 PMwide-art-99889
05/23/2023, 9:02 PMlemon-wall-20836
05/23/2023, 9:03 PMlemon-wall-20836
05/23/2023, 9:03 PMapp/assets/styleshhets
?lemon-wall-20836
05/23/2023, 9:03 PMwide-art-99889
05/23/2023, 9:03 PMlemon-wall-20836
05/23/2023, 9:03 PMwide-art-99889
05/23/2023, 9:03 PMwide-art-99889
05/23/2023, 9:04 PMlemon-wall-20836
05/23/2023, 9:04 PMlemon-wall-20836
05/23/2023, 9:04 PMwide-art-99889
05/23/2023, 9:04 PMcd assets
the heroku shell exitedwide-art-99889
05/23/2023, 9:04 PMwide-art-99889
05/23/2023, 9:04 PMwide-art-99889
05/23/2023, 9:05 PMwide-art-99889
05/23/2023, 9:06 PMlemon-wall-20836
05/23/2023, 9:06 PMlemon-wall-20836
05/23/2023, 9:06 PMwide-art-99889
05/23/2023, 9:07 PMwide-art-99889
05/23/2023, 9:07 PMwide-art-99889
05/23/2023, 9:10 PMwide-art-99889
05/23/2023, 9:10 PMwide-art-99889
05/23/2023, 9:11 PMwide-art-99889
05/23/2023, 9:13 PMwide-art-99889
05/23/2023, 9:14 PMwide-art-99889
05/23/2023, 9:14 PMwide-art-99889
05/23/2023, 9:14 PMwide-art-99889
05/23/2023, 9:18 PMwide-art-99889
05/23/2023, 9:26 PM//= link_tree ../images
//= link_tree ../builds
//= link application.css
pretty straightforwardlemon-wall-20836
05/23/2023, 9:27 PMlemon-wall-20836
05/23/2023, 9:27 PMlemon-wall-20836
05/23/2023, 9:27 PMlemon-wall-20836
05/23/2023, 9:27 PMlemon-wall-20836
05/23/2023, 9:27 PMwide-art-99889
05/23/2023, 9:29 PMlemon-wall-20836
05/23/2023, 9:29 PMwide-art-99889
05/23/2023, 9:29 PMlemon-wall-20836
05/23/2023, 9:29 PMwide-art-99889
05/23/2023, 9:29 PMRAILS_ENV=production bundle exec rake assets:precompile
locally just now, and it appeared to choose the correct filelemon-wall-20836
05/23/2023, 9:30 PMlemon-wall-20836
05/23/2023, 9:30 PMyarn avo:tailwindcss
command shouldwide-art-99889
05/23/2023, 9:30 PMlemon-wall-20836
05/23/2023, 9:30 PMlemon-wall-20836
05/23/2023, 9:30 PMasst/builds
and delete everything and run RAILS_ENV=production bundle exec rake assets:precompile
lemon-wall-20836
05/23/2023, 9:30 PMwide-art-99889
05/23/2023, 9:30 PMwide-art-99889
05/23/2023, 9:31 PMlemon-wall-20836
05/23/2023, 9:31 PMlemon-wall-20836
05/23/2023, 9:31 PMwide-art-99889
05/23/2023, 9:31 PMheroku run bash
I can see the compiled css filewide-art-99889
05/23/2023, 9:31 PMlemon-wall-20836
05/23/2023, 9:31 PMwide-art-99889
05/23/2023, 9:31 PMlemon-wall-20836
05/23/2023, 9:32 PMwide-art-99889
05/23/2023, 9:32 PM~ $ ls -l app/assets/builds
total 956
-rw------- 1 u36557 dyno 264284 May 23 21:12 application.js
-rw------- 1 u36557 dyno 460324 May 23 21:12 application.js.map
-rw------- 1 u36557 dyno 79044 May 23 21:12 avo.custom.js
-rw------- 1 u36557 dyno 140130 May 23 21:12 avo.custom.js.map
-rw------- 1 u36557 dyno 10414 May 23 21:12 avo.tailwind.css
-rw------- 1 u36557 dyno 10414 May 23 21:12 tailwind.css
~ $
lemon-wall-20836
05/23/2023, 9:32 PMlemon-wall-20836
05/23/2023, 9:33 PMassets/stylesheets/avo.tailwidn.css
instead of the builds
one?wide-art-99889
05/23/2023, 9:33 PMlemon-wall-20836
05/23/2023, 9:33 PMstylesheets
one?wide-art-99889
05/23/2023, 9:33 PMwide-art-99889
05/23/2023, 9:33 PMwide-art-99889
05/23/2023, 9:33 PMlemon-wall-20836
05/23/2023, 9:33 PMwide-art-99889
05/23/2023, 9:34 PMwide-art-99889
05/23/2023, 9:34 PMwide-art-99889
05/23/2023, 9:34 PMwide-art-99889
05/23/2023, 9:34 PMwide-art-99889
05/23/2023, 9:34 PMwide-art-99889
05/23/2023, 9:35 PMlemon-wall-20836
05/23/2023, 9:37 PMlemon-wall-20836
05/23/2023, 9:38 PMwide-art-99889
05/23/2023, 9:39 PMlemon-wall-20836
05/23/2023, 9:39 PMwide-art-99889
05/23/2023, 9:40 PMwide-art-99889
05/23/2023, 9:40 PMlemon-wall-20836
05/23/2023, 9:41 PMwide-art-99889
05/23/2023, 9:41 PMlemon-wall-20836
05/23/2023, 9:41 PMwide-art-99889
05/23/2023, 9:42 PMwide-art-99889
05/23/2023, 9:42 PMwide-art-99889
05/23/2023, 9:42 PMlemon-wall-20836
05/23/2023, 9:42 PMwide-art-99889
05/23/2023, 9:42 PMlemon-wall-20836
05/23/2023, 9:42 PMwide-art-99889
05/23/2023, 9:43 PMlemon-wall-20836
05/23/2023, 9:44 PMlemon-wall-20836
05/23/2023, 9:44 PMwide-art-99889
05/23/2023, 9:45 PMlemon-wall-20836
05/23/2023, 9:51 PM