仅预编译一项资产

仅预编译一项资产

本文介绍了Rails资产:仅预编译一项资产?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前我们有一个Rails应用程序,但是我对资产预编译有一个疑问.

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

每次编辑一个文件(样式表或javascript文件)时,我们都必须运行:
bundle exec rake assets:precompile
...然后再次上传所有内容,甚至是那些完全没有更改的文件.

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.

有没有办法只编译已编辑的文件和manifest.yml文件?

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

谢谢.

推荐答案

我也遇到了这样的问题,在谷歌上搜索了很多,发现了一个叫做: 护栏资源

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

只要有更改,它就会在Rails 3.1应用程序中编译资产.

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

签出

这篇关于Rails资产:仅预编译一项资产?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 15:08