在 config/application.rb 中,已经设置 config.assets.enabled = true,将 pipeline 开启, 那么在网页访问时,app/assets/javascripts/ 下的所有文件都会被打包到 application.js 中对吧? 可是我在 development 模式下 rails server 后,访问 localhost,查看源码时,显示的是:
1 // This is a manifest file that'll be compiled into application.js, which will include all the files
2 // listed below.
3 //
4 // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6 //
7 // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 // the compiled file.
9 //
10 // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11 // GO AFTER THE REQUIRES BELOW.
12 //
13 //= require jquery
14 //= require jquery_ujs
15 //= require_tree .
16 //= require bootstrap
17
18 !function( $ ) {
19
20 // Picker object
21
22 .....
即依旧是原先 application.js 中的内容,require 的 jquery bootstrap 都未打包进去。 Gemfile 的配置应该是没有问题的。还有哪儿可能造成这样的结果?