-
Notifications
You must be signed in to change notification settings - Fork 43
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
Built CSS is only picked up by second precompilation #48
Comments
I think I'm running into this too. Did you figure out a solution @steerio ? |
This indeed is a problem, still in March 2024 after 4 months |
@steerio do you use |
I fixed this by adding back I have this on my gitignore and dockerignore, which I believe is the default for Rails these days:
Even though that dir gets recreated by dartsass-rails when running
Something like that. Or maybe I just configured propshaft and/or dartsass-rails wrong. Who knows. |
Oh shoot, It's because of missing
I think you can resolve this issue then |
Actually I would keep the issue and add a PR that resolves it, I think dartsass should create Something similar to what other rails projects use, e.g. FileUtils.mkdir_p(builds_root)
keep = File.join(builds_root, ".keep")
FileUtils.touch(keep) |
Yes. I agree this seems necessary @januszm. It's a gotcha that actually brought our server down for hours yesterday, it took us awhile to figure what the heck could be wrong. What we tried was a very minimal PR to switch a legacy Rails 7.1.3 app to Even reverting the changes wouldn't allow the server to boot — at that point the |
I've just added this as an extra deployment step: yarn install; bin/rails assets:precompile if something is missing, it will do the work, if node_modules are installed and all assets precompiled already, it exits really fast so it won't delay the deployment. |
thanks @januszm - Hm. Our deploy script already tries to run |
For some reason my .keep file was also lost somewhere in my development process. It took me 6 hours to figure this out, but hey, at least now I have an idea of how Sprocket and Dart Sass work together. Thanks for sharing, guys! |
When one runs
rake assets:precompile
, thedartsass:build
task is indeed run before the precompilation task, but it appears that the latter won't pick up assets written to theapp/assets/builds
folder by the former, unless the files had been present there before startup in the first place.To reproduce the error:
rails dartsass:install
.app/assets/stylesheets/application.scss
.stylesheet_link_tag "application"
.rake assets:precompile
.app/assets/builds/application.css
file, sodartsass:build
has run successfully.application-<hash>.css
in the Sprockets manifest (public/assets/.sprockets-manifest-*.json
), nor has it been packed up inpublic/assets
.rake assets:precompile
again.manifest.js
), but nothing else.application-<hash>.css
is now in the Sprockets manifest and appears inpublic/assets
as well.Subsequent runs of
rake assets:precompile
will not yield any further changes (provided that none of the assets were modified).The text was updated successfully, but these errors were encountered: