1

I precompiled all my Javascript files so they can be called from within other pages. However, now Rails precompiles all of the files in vendor every time, even though they rarely change. How do I get it to ignore vendor when precompiling and just use the previous precompiled vendor files?

Here's my code from production.rb:

config.assets.precompile += ['*.js']

Update: I want it to ignore vendor for 2 reasons:

  1. It takes around 5 minutes to precompile all the files, so I just want it to use the previous ones.
  2. Even worse, it's unable to precompile one of the files, so I have to redo that file myself.

How can I speed this up and skip those files?

am-rails
  • 1,463
  • 2
  • 16
  • 40
  • If the files are not changing, the asset pipeline should be generating the same pre-compiled files with the same hash added to the file name. Are you wanting to not even attempt to compile these files since they have not changed? – steakchaser Mar 05 '14 at 06:45
  • did you try anything? – Rajesh Omanakuttan Mar 05 '14 at 06:56
  • I don't have a good answer for you, but essentially what you need to do is figure out how to get the pipeline to only compile assets that have changed - either via some customization of the `config.assets.precompile` or via a custom `rake` task. For the first, maybe you can look at / use this gem: https://github.com/ndbroadbent/turbo-sprockets-rails3 – steakchaser Mar 05 '14 at 17:16
  • I also came across this post which shows a number of custom `Proc`s people have made to control which assets get compiled. It's not a direct solution to your issue, but might help you get some ideas if the above gem does not work. http://stackoverflow.com/questions/10097993/rails-config-assets-precompile-setting-to-process-all-css-and-js-files-in-app-as – steakchaser Mar 05 '14 at 17:18

1 Answers1

0

It is a good feature that whenever some change happens to our static files, it should be precompiled to get a faster performance.

Just put the below code to skip it:

In config/environmets/production.rb,

config.assets.compile = true

Now, it will never do precompilation every time instead it will enforce Live Compilation.

Rajesh Omanakuttan
  • 6,788
  • 7
  • 47
  • 85