Rails不会编译资产,但会在日志中显示编译,rake资产:预编译不生成文件

时间:2014-06-28 22:30:02

标签: ruby-on-rails ruby-on-rails-3 asset-pipeline precompile

当我运行rake assets:precompile时,它会在日志中显示它编译plugin.jsknockout,但这些文件不在public/assets中。有什么问题?

的application.js

//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require ckeditor/init
//= require_tree .

搜索文件:

[vagrant@localhost BK-Development]$ find public/assets -name plugin.js
[vagrant@localhost BK-Development]$ find public/assets -name knock\*

[vagrant@localhost BK-Development]$ grep plugin.js log/production.log
Compiled ckeditor/plugins/youtube/plugin.js  (0ms)  (pid 32556)
Compiled ckeditor/plugins/youtube/plugin.js  (0ms)  (pid 32556)
[vagrant@localhost BK-Development]$ grep knockout log/production.log
Compiled knockout-3.1.0.js  (0ms)  (pid 32556)
Compiled knockout-3.1.0.js  (0ms)  (pid 32556)

[vagrant@localhost BK-Development]$ grep plugin.js public/assets/manifest.yml
[vagrant@localhost BK-Development]$ grep knockout public/assets/manifest.yml
[vagrant@localhost BK-Development]$

这些都在我的production.rb中。不应该是相关的。

config.serve_static_assets = true
config.assets.compress = true
config.assets.compile = true
config.assets.digest = true
config.assets.precompile += %w( bootstrap.modal.js bootstrap.modal.css application/_helper_classes.css 
bootstrap-datepicker.js bootstrap-datepicker.css books_admin.js categories.js posts.js )

Rails 3.2.14

1 个答案:

答案 0 :(得分:0)

我明确地将knockout-3.1.0.jsplugin.js添加到config.assets.precompile,并在public/assets中生成了文件。我仍然不知道为什么它会产生除了那些之外的所有其他JS文件。