Rails在开发模式下没有在Rails 4.0.x中找到供应商/资产?

时间:2014-03-22 01:59:05

标签: ruby-on-rails ruby-on-rails-4 asset-pipeline

我有以下设置:

gem 'rails', '~> 4.0.3'

config/application.rb

 config.assets.paths << Rails.root.join('vendor', 'assets', 'components')

vendor/assets/components/gridster/dist

jquery.gridster.min.css  jquery.gridster.with-extras.min.js
jquery.gridster.min.js

然而,一旦我转到http://localhost:3000/并在浏览器中查看来源,这些资产就没有出现......我需要做些什么才能让它们在那里?

更新

application.js

//= require jquery
//= require jquery_ujs
//= require jquery.validate
//= require bootstrap
//= require dataTables/jquery.dataTables
//= require dataTables/jquery.dataTables.bootstrap3
//= require jquery.gridster.min
//= require jquery.gridster.with-extras.min
//= require_tree .

application.css.scss

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require dataTables/jquery.dataTables
 *= require dataTables/jquery.dataTables.bootstrap3
 *= require jquery.gridster.min
 *= require_tree .
 */

1 个答案:

答案 0 :(得分:1)

在application.js中,添加以下行

//= require gridster/dist/jquery.gridster.min
//= require gridster/dist/jquery.gridster.with-extras.min

在application.css中,添加以下行

*= require gridster/dist/jquery.gridster.min

您需要添加reference个文件,以便Sprockets搜索默认资源位置,即app/assetslib/assetsvendor/assets以及附加到{{config.assets.paths的任何其他路径1}}