Ruby Rails precompiling assets vs. using the asset pipeline
<p>I'm wondering when to use <code>Rails.application.config.assets.precompile</code> to include Javascript plugins, and when to use the asset pipeline.  From what I understand, the asset pipeline minifies all files listed in it, and it makes this minified file available to the entire application. However, you can use <code>Rails.application.config.assets.precompile</code> in <strong>config/initializers/assets.rb</strong> to allow a plugin to be used only on specific pages.  Is this understanding correct?</p>

<p>For instance, if I have the lines below in my <strong>config/initializers/assets.rb</strong> file:</p>

<pre><code>Rails.application.config.assets.precompile += %w( plugins/footable/angular-footable.js )
Rails.application.config.assets.precompile += %w( plugins/footable/footable.all.min.js )
Rails.application.config.assets.precompile += %w( plugins/footable/footable.core.css )
</code></pre>

<p>Then I can use the Foo Table plugin in my <strong>app/views/users/index.html.erb</strong> file:</p>

<pre><code>&lt;%= javascript_include_tag 'plugins/footable/angular-footable' %&gt;
&lt;%= javascript_include_tag 'plugins/footable/footable.all.min' %&gt;
&lt;%= stylesheet_link_tag 'plugins/footable/footable.core' %&gt;
</code></pre>

<p>Is this a proper usage?</p>

<p>The reason I ask is because I want to use the Foo Table plugin (among others) only on the <strong>app/views/users/index.html.erb</strong> page.  I thought about including the plugin in the asset pipeline, but I didn't want to bog down the rest of my application with Javascript code that was only needed by one page.</p>