Created
April 2, 2026 15:04
-
-
Save jasonkarns/95aa2cb4c11f8f8cf355802dbf8fa86f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| desc "Compare frontend asset builds between branches" | |
| task :diffassets, [:branch] do |t, args| | |
| sh "git diff-index --quiet HEAD --" do |ok, res| | |
| abort "Working directory not clean. Stash or commit first." unless ok | |
| end | |
| args.with_defaults(branch: "-") # git's magic for "last branch" | |
| # start in main, do clean asset build, and temporarily force-add to git | |
| sh "git switch main" | |
| sh "rake assets:clobber assets:precompile" | |
| sh "git add -f app/assets public" | |
| # switch (back) to feature branch, rebuild, and diff | |
| sh "git switch #{args[:branch]}" | |
| sh "rake assets:clobber assets:precompile" | |
| sh "git diff --stat" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment