【发布时间】:2013-10-10 03:48:02
【问题描述】:
我正在研究资产预编译,我很困惑。
假设我创建了一个新应用程序,例如 rails new dummy。
这是生成的app/assets/javascripts/application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
上面写着This is a manifest file that'll be compiled into application.js。到这一步还是很清楚的,但是我发现在config/application.rb下还有另外一个配置可以设置:config.assets.precompile << \some_regex\。
现在我不清楚更改 application.js 与 config.assets.precompile 以选择要编译的内容有什么区别。
我觉得我在这里错过了大局,有人可以帮忙解释一下吗?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 asset-pipeline