【发布时间】:2014-03-22 01:59:05
【问题描述】:
我有以下设置:
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 .
*/
【问题讨论】:
-
您可以发布您的
application.js清单吗?你可能忘了把它们放在那里。你应该可以做类似//= require_tree gridster -
是的,我忘了把它放在application.js中
标签: ruby-on-rails ruby-on-rails-4 asset-pipeline