问题描述:

Can anyone explain what the use of the following directories is?

  • app/assets/
  • lib/assets/
  • vendor/assets/

网友答案:

These directories are all a part of Rails' Asset Pipeline.

Conceptually, the app/assets directory is for your application assets (for instance, the stylesheets and images for your application). lib/assets is for all of the code that you've written that stands alone from your rails app (javascript library, maybe). vendor/assets is meant to house all third party libraries (e.g. jQuery).

All of these paths are included by default in the asset pipeline. This means that their contents can be included into other files using sprockets, concatenating automatically into one file (javascript or css), reducing the number of requests and thus the loading time. The asset pipeline can also compile your coffeescript and minify your javascript for production.

相关阅读:
Top