1

I have a rails application with locomotive cms engine mounted. Compilation of all locomotive assets takes a lot of time (5-10 minutes). Since I do not change locomotive assets, I would like to precompile it only once.

The best solution would be to force rake assets:precompile to compile only application assets and skip compilation of locomotive assets. Already compiled locomotive assets might be added to the git repository.

Is there any easy way to achieve this?

Konrad
  • 1,605
  • 3
  • 24
  • 45
  • See http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets, you can set a Proc to `config.assets.precompile << Proc.new do |path|`. You could use a Proc like this to check if locomotive assets already exists, and not compile them in this case. – Baldrick Nov 26 '13 at 08:23

1 Answers1

2

Try Turbo Sprockets. From the README:

  • Speeds up your Rails 3 rake assets:precompile by only recompiling changed assets, based on a hash of their source files
  • Only compiles once to generate both fingerprinted and non-fingerprinted assets
Benjamin Tan Wei Hao
  • 9,621
  • 3
  • 30
  • 56
  • This gem looks promising. I tried that, but it doesn't speed up very much. Instead of 10 minutes it took about 9 minutes. I didn't have time to find out why, but maybe it is an issue on my side. Thanks. I will keep you up to date! – Konrad Dec 02 '13 at 12:35
  • Are you hosting your assets on S3? If so, you could check out asset_sync too. You could also try to remove empty js files. – Benjamin Tan Wei Hao Dec 05 '13 at 02:26
  • No, i'm not. My compiled assets are stored locally in public/assets directory. – Konrad Dec 05 '13 at 07:14
  • 1
    The problem was that my rake command executes assets:clean command everytime. When I stubbed this method, the command executes a bit faster (depending on how many changes are in assets files). Thanks for you answer. – Konrad Dec 07 '13 at 14:47