discover-unused-partials
discover-unused-partials copied to clipboard
A script to help you finding out unused partials. Good for big projects or projects under heavy refactoring
# Description I am getting an error when using a partial in one of my layout ERB files. I have tried a variety of permutations and nothing works. The following...
When I run `discover-unused-partials` it fails with this error: ``` /app # discover-unused-partials . Traceback (most recent call last): 16: from /usr/local/bundle/bin/discover-unused-partials:23:in `' 15: from /usr/local/bundle/bin/discover-unused-partials:23:in `load' 14: from /usr/local/bundle/gems/discover-unused-partials-0.3.5/bin/discover-unused-partials:24:in...
I have a file called something like: app/views/things/partials/_view_thing_stuff.html.slim It was returned as "unused", though doing a code search, I found instances where it was being rendered with this syntax: ``...
`> discover-unused-partials .` The following partials are not referenced directly by any code: ... app/views/application/_flash_dropdown.haml ... In a view: ``` = render layout: 'navigation_header' do = render partial: 'flash_dropdown' ```
search inside js files for ajax
We had the interesting case of a partial that wasn't used anywhere but `discover-unused-partials` didn't list it as the partial did call itself (rendering a tree).
When I render an object directly it tells me its associated partial is not used. ``` haml / renders /app/views/tasks/_task.html.haml = render @task / or = render task ```
Sometimes we use partials that contain locale in their names, for example: _partial.ru.html.haml _partial.en.html.haml They are marked as unused, but it is not true.