Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A script to help you finding out unused partials. Good for big projects or projects under heavy refactoring
Ruby
Branch: master
Failed to load latest commit information.
bin More parenthesis
lib no, really, bumping
spec Updating gem build method to use bundler.
.gitignore Including a gitignore file for generated gem file
Gemfile Updating gem build method to use bundler.
LICENSE Including files in gem pattern
README.rdoc
Rakefile Updating gem build method to use bundler.
VERSION Bump version
discover-unused-partials.gemspec Updating gem build method to use bundler.

README.rdoc

Description

This utility script (which someday will be a Rails plug-in) was made in order to help developers to find out unused partials.

Usage

Install the gem

gem install discover-unused-partials

Run the script

To use this script, simply run

discover-unused-partials path/to/your/rails_root

If path is not provided, script is executed in the current directory

It will return a list of unmentioned partials. It supports detection of Haml and Erb (both .erb and .rhtml) templates.

Configuration

To fine-tune script behavior, you can add discover-unused-partials.yml to your app config directory. Content of such file:

# List of files that are not reported
keep:
  - app/views/my/partial/_to_keep.html.erb

# List of dynamically generated partials and their sources
dynamic:
  app/controllers/user_controller.rb:
    - app/views/user/_first_dynamic_partial.html.erb
    - app/views/user/_second_dynamic_partial.text.haml

Thanks

Special thanks goes to Willian Molinari (PotHix) and Mateus Linhares (mateuslinhares) that helped me writing this little script.

Something went wrong with that request. Please try again.