1

I am using ubuntu 10.10. In my rails 3.1 project, css & javascript code is not loading even after precompile. I am using twitter bootstrap tool but this functionality is not working. Eg: Icons are not loading, buttons UI is not displaying properly.

I am using below command to precompile,

rake assets:precompile -t

In application.rb i have given

config.assets.enabled = true
config.encoding = "utf-8"

My development.rb is like,

Azzist::Application.configure do

 config.cache_classes = false
 config.whiny_nils = true
 config.consider_all_requests_local       = false
 config.action_controller.perform_caching = true
 config.log_level = :debug

 config.assets.precompile += %w( abootstrap.js bootstrap-timepicker.js jquery.imgareaselect.pack.js application.css cv_builder.css widget.css imgareaselect-default.css)

 config.assets.compile = true
 config.serve_static_assets = true
 config.assets.compress = true
 config.assets.js_compressor  = :uglifier

 config.action_dispatch.best_standards_support = :builtin

 config.autoload_paths += %W(#{Rails.root}/app/sweepers)
 config.action_controller.page_cache_directory = "#{Rails.root}/cache/pages"
 config.cache_store = :dalli_store

 config.action_mailer.raise_delivery_errors = true
 config.i18n.fallbacks = true
 config.active_support.deprecation = :notify

 # Default url options
 ENV["HOST"] = "http://localhost:3000"
 ENV["LOG_IT"] = "true"
 config.action_mailer.default_url_options = {:host => ENV["HOST"]}
 default_url_options[:host] = ENV["HOST"]

 config.action_controller.asset_host = "http://localhost:3000"

 ## Setting up the memcache server
 ENV["MEMCACHE_SERVER"] = "http://localhost:3000"

end

My application.js is,

//= require jquery
//= require jquery_ujs

//= require twitter/bootstrap
//= require bootstrap-button
//= require bootstrap-datepicker
//= require jquery.tokeninput
//= require jquery.vticker
//= require jquery.Jcrop.min
//= require jquery.effects.core
//= require jquery.effects.highlight
//= require highlight
//= require noty

//= require tinymce-jquery

//= require jquery.joyride-1.0.3
//= require jquery.bxslider
//= require jquery.bxslider.min

//= require jquery.jcarousel.min
//= require modernizr-2.5.3.min

//= require_tree .

My application.css is,

/*

* require_self
* require_tree . 

*= require main
*= require bootstrap_override
*= require datepicker
*= require typography
*= require token-input
*= require token-input-facebook

*= require skin
*= require jquery.ptTimeSelect
*= require jquery.Jcrop
*= require jquery.bxslider

*= require joyride-1.0.3

*= require noty
*= require noty_theme_twitter

*= require_self

*/

Need some assistance. Long before i was asked this same question but still it is not solved.

4

2 回答 2

1
# Do not compress assets
config.assets.compress = false
config.assets.precompile = false

尝试使用没有预编译和压缩的应用程序。

于 2013-01-24T10:26:02.683 回答
0

我可以在你身上看到你application.css的双重陈述require_self。通常你应该把所有需要的文件放在require_tree和之前require_self

另一个很好的做法是:在开发中不要预编译资产,它们应该用作源,因为它们应该反映您在开发过程中所做的更改。

  • require_self 和 * require_tree 。不会做任何事情作为评论。需要“=”(等号)才能将其视为包含语句。
于 2013-01-24T10:12:47.660 回答