我有以下设置:
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 .
*/
答案 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/assets
,lib/assets
和vendor/assets
以及附加到{{config.assets.paths
的任何其他路径1}}