Juanda
Juanda

Reputation: 1658

Rails assets:precompile only one asset?

Currently we have a Rails application but I have one question regarding the assets precompilation.

Each time that I edit one file (stylesheet or javascript file), we have to run:
bundle exec rake assets:precompile
...and then upload everything again, even those files that didn't changed at all.

Is there a way to compile only the edited files and the manifest.yml file?

Thanks in advance.

Upvotes: 4

Views: 4621

Answers (2)

Said Kaldybaev
Said Kaldybaev

Reputation: 9952

i also had such a question, googled a lot and found one gem called: guard-rails-assets

It compiles the assets within Rails 3.1 application whenever those change.

For example, you can do this:

# compile ONLY when something changes
guard 'rails-assets', :run_on => :change do
  watch(%r{^app/assets/.+$})
end

Check it out

Upvotes: 4

gayavat
gayavat

Reputation: 19398

I think no and unneccessary because all js files are compiled to one file as and css files. If you changed only one file - you changed such combined files. But, if you want to update resource file such as images, I think, you may, only place it in right directory under public/accets

Upvotes: 2

Related Questions