Skip to content

Commit

Permalink
Add possibility to skip css:build during assets:precompile (#99)
Browse files Browse the repository at this point in the history
* Better: Add CSS_BUILD env var to skip css:build

* Change for SKIP_CSS_BUILD

* Fix single quotes

Co-authored-by: Yoann Lecuyer <yoann.lecuyer@ringcentral.com>
Co-authored-by: David Heinemeier Hansson <dhh@hey.com>
  • Loading branch information
3 people committed Jan 9, 2023
1 parent 052ba22 commit 0a1d993
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/tasks/cssbundling/build.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ namespace :css do
desc "Build your CSS bundle"
task :build do
unless system "yarn install && yarn build:css"
raise "cssbundling-rails: Command css:build failed, ensure yarn is installed and `yarn build:css` runs without errors"
raise "cssbundling-rails: Command css:build failed, ensure yarn is installed and `yarn build:css` runs without errors or use SKIP_CSS_BUILD env variable"
end
end
end

if Rake::Task.task_defined?("assets:precompile")
Rake::Task["assets:precompile"].enhance(["css:build"])
end
unless ENV["SKIP_CSS_BUILD"]
if Rake::Task.task_defined?("assets:precompile")
Rake::Task["assets:precompile"].enhance(["css:build"])
end

if Rake::Task.task_defined?("test:prepare")
Rake::Task["test:prepare"].enhance(["css:build"])
elsif Rake::Task.task_defined?("db:test:prepare")
Rake::Task["db:test:prepare"].enhance(["css:build"])
if Rake::Task.task_defined?("test:prepare")
Rake::Task["test:prepare"].enhance(["css:build"])
elsif Rake::Task.task_defined?("db:test:prepare")
Rake::Task["db:test:prepare"].enhance(["css:build"])
end
end

0 comments on commit 0a1d993

Please sign in to comment.