I'm using the guard-rails-assets gem to compile my assets in dev on every asset change. My problem is, whenever i change one assets, guard compiles all assets. Is there a way to have it compile only the changed asset?
Here is my guard file:
guard 'rails-assets' do
watch(%r{^app/assets/.+$})
end
Many thanks!
Uri
Judging from the source code:
https://github.com/dnagir/guard-rails-assets/blob/master/lib/guard/rails-assets.rb
And:
https://github.com/dnagir/guard-rails-assets/blob/master/lib/guard/rails-assets/cli_runner.rb
I strongly suspect the answer is "no". The gem isn't doing anything special to compile the assets. It is just shelling out to the built in rails assets:precompile
rake task. And this task recompiles all assets.
This is probably hard to pull off because you'd have to understand the full asset dependency graph to figure out what compiled assets are impacted by changes to a specific source file, and by the time you've done all that, you may as well compile. Sprockets may not even expose that information outside a full compile.