No release in over 3 years
DeadweightRails scans your Rails project for dead assets and unused Ruby code.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 3.12

Runtime

>= 0
>= 0
 Project Readme

DeadweightRails

Gem Version

DeadweightRails scans your Rails project for unused assets and Ruby code, helping you reduce bundle size, improve performance, and clean your codebase.


Features

  • Detect unused CSS and JS in Rails asset pipeline
  • Detect unused Ruby methods
  • Generate a report in terminal with colored output
  • Works with standard Rails directories (app/assets, app/views, app/models)
  • Simple Rake task integration

Installation

Add this line to your Gemfile:

gem 'deadweight_rails'

Then execute:

bundle install

Or install it yourself:

gem install deadweight_rails

Usage

1. Rake task

Add this task to lib/tasks/deadweight.rake:

require "rake"
require "deadweight_rails"

namespace :deadweight do
  desc "Scan Rails project for unused assets and Ruby code"
  task :scan do
    DeadweightRails.run
  end
end

Run the task:

bundle exec rake deadweight:scan

2. Programmatically

require "deadweight_rails"

# Scan current Rails project
DeadweightRails.run

# Or scan a specific path
DeadweightRails.run(path: "/path/to/project")

Example Output

🔎 DEADWEIGHTRAILS REPORT

--- Assets ---
Unused CSS: old.css
Unused JS:  legacy.js

--- Ruby ---
Unused Methods: old_helper

Development

After checking out the repo, run:

bin/setup
rake spec
bin/console

To install the gem locally:

bundle exec rake install

To release a new version:

bundle exec rake release

Contributing

Bug reports and pull requests are welcome on GitHub: gem "deadweight_rails", path: "../deadweight_rails" https://github.com/[USERNAME]/deadwe