This is possible with the new stub Sprocket directive, which is available in Sprockets v2.2.0 and higher. However, Rails 3.2 will only use Sprockets v2.1.3, which does not have this feature. Currently, the current Edge Rails have a stub directive, and it will officially be in Rails 4.0 and higher.
Using:
//= require jquery //= require_tree . //= stub unwanted_js
Directives
stub cannot be overridden by the following require or include directives.
If you want to use the stub directive in your Rails 3.2 project, you will have to switch to Edge Rails or branch your Rails stone with your Sprockets dependency, modified to version 2.2.0.
Joseph Jaber Mar 08 2018-12-12T00: 00Z
source share