Skip to content
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

Tell Heroku to build the redesign CSS, too #704

Merged
merged 1 commit into from Oct 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,12 @@
namespace :css do
desc "Build your CSS bundle for the redesign"
task :redesign do
unless system "yarn install && yarn build:redesign"
raise "Command css:redesign failed, ensure yarn is installed and `yarn build:redesign` runs without errors"
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system is able to raise a more specific and verbose error if you pass exception: true to it.

https://rubyapi.org/3.1/o/kernel#method-i-system

Suggested change
unless system "yarn install && yarn build:redesign"
raise "Command css:redesign failed, ensure yarn is installed and `yarn build:redesign` runs without errors"
end
system "yarn install && yarn build:redesign", exception: true

Rails recently made a similar change to what I'm suggesting. rails/rails@24fbbe0

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know! Thanks for sharing.

I copy-pasted this from cssbundling-rails and jsbundling-rails. But for custom system calls I'll make sure to use exception: true in the future.

end
end

if Rake::Task.task_defined?("assets:precompile")
Rake::Task["assets:precompile"].enhance(["css:redesign"])
end