0
votes

rails-3.2.7

ruby-2.1.0-preview1 [ x86_64 ]

execute command rake assets:precompile but can not get any response. when compiling finished css files didn't merged,just saw code like .right{float:right;}

/*
 * 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 bootstrap_and_overrides
 *= require nested_sortable
 *= require tag_it
 *= require jquery.lightbox-0.5
 *= require morris
 *= require jquery.ui.datepicker
 *= require articles
 *= require messages
 *= require workorder
 *= require community
 *= require homepage
 */

/* require_tree . */
.right { float: right; }

⇒ rake assets:precompile

DEPRECATION WARNING: CarrierWave::MimeTypes is deprecated and will be removed in the future, get the content_type from the SanitizedFile object directly. (will be removed from version 0.11.0). (called from require at /Users/Saxer/.rvm/gems/ruby-2.1.0-preview1@global/gems/bundler-1.8.0/lib/bundler/runtime.rb:76)

/Users/Saxer/.rvm/rubies/ruby-2.1.0-preview1/bin/ruby /Users/Saxer/.rvm/gems/ruby-2.1.0-preview1/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets DEPRECATION WARNING: CarrierWave::MimeTypes is deprecated and will be removed in the future, get the content_type from the SanitizedFile object directly. (will be removed from version 0.11.0). (called from require at /Users/Saxer/.rvm/gems/ruby-2.1.0-preview1@global/gems/bundler-1.8.0/lib/bundler/runtime.rb:76) DEPRECATION WARNING: CarrierWave::MimeTypes is deprecated and will be removed in the future, get the content_type from the SanitizedFile object directly. (will be removed from version 0.11.0). (called from require at /Users/Saxer/.rvm/gems/ruby-2.1.0-preview1@global/gems/bundler-1.8.0/lib/bundler/runtime.rb:76)

gemfile

# source 'https://rubygems.org'
source 'http://ruby.taobao.org/'

gem 'rails', '3.2.7'
gem 'dalli', github: 'mperham/dalli'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
gem 'mysql2'
gem 'memcached'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
  gem 'bootstrap-sass', '~> 2.1.0.1'

  gem 'jquery-ui-rails'
end

group :development do
  # Haml-rails provides Haml generators for Rails 3.
  # Any time you generate a controller or scaffold, you'll get Haml instead of ERB templates.
  gem "haml-rails", ">= 0.3.4"

  # Annotate ActiveRecord models as a gem
  # USAGE
  # To annotate just your models: annotate --exclude tests,fixtures
  # To annotate routes.rb: annotate -r
  gem 'annotate', ">=2.5.0.pre1"
  gem 'pry'
  # gem 'debugger'
  gem 'pry-rails'

  # Mutes assets pipeline log messages.
  # Nothing to do, but if you want to temporarily turn on back assets' log just write:
  gem 'quiet_assets'
  gem 'wirble'
  gem 'hirb'
  gem 'pasteboaRb'
  gem 'awesome_print'
  # gem "better_errors"
  # gem 'letter_opener'
end

gem 'devise'
gem "cancan"
gem 'jquery-rails'
gem "haml", ">= 3.1.6"
gem "simple_form"
gem "thin"
gem 'kaminari'
gem 'mini_magick'
# gem 'carrierwave', :git => 'git://github.com/wjp2013/carrierwave.git'
gem 'carrierwave'
# https://github.com/huacnlee/carrierwave-aliyun
gem 'rest-client'
gem 'carrierwave-aliyun'

gem 'acts-as-taggable-on', '~> 2.3.1'
gem 'mercury-rails'
# Nested Set is an implementation of the nested set pattern for ActiveRecord models.
# https://github.com/skyeagle/nested_set
gem 'nested_set', '1.7.1'
gem 'bluestorm_sms', '0.0.4'

# Whenever create cron jobs using Ruby, Cron is a common solution for recurring jobs.
gem 'whenever', require: false
gem "ckeditor", "3.7.1"
# rubyzip is a ruby library for reading and writing zip files.
gem 'rubyzip'
# xlsx generation
# https://github.com/straydogstudio/axlsx_rails
gem 'axlsx_rails'

gem 'fastercsv'
gem 'spreadsheet'

gem "nested_form"
# amoeba is a ruby gem to allow the copying of ActiveRecord objects and their associated children, configurable with a DSL on the model.
# https://github.com/rocksolidwebdesign/amoeba
# gem 'amoeba'
gem "httparty"

gem 'exception_notification', :require => 'exception_notifier'
# Long requests should be moved into a background process.
# Delayed Job is one of the easiest ways to do this because it works with an Active Record database.
# https://github.com/collectiveidea/delayed_job
# http://railscasts.com/episodes/171-delayed-job-revised
gem 'daemons'
gem 'delayed_job_active_record'
gem "delayed_job_web"

gem 'china_region_fu'
gem "rails3_acts_as_paranoid"
# Whitelist-based Ruby HTML sanitizer.
# https://github.com/rgrove/sanitize
gem 'sanitize'

# AutoStripAttributes gem for Rails helps to remove unnecessary whitespaces from ActiveRecord or ActiveModel attributes.
# https://github.com/holli/auto_strip_attributes
gem "auto_strip_attributes"

gem 'best_in_place'

# https://github.com/pencil/encrypted_id
gem 'encrypted_id'

# https://github.com/chadlwm/ip_reverse
gem 'ip_reverse'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
gem 'igetui-ruby', require: 'igetui'
# gem 'aliyun-mqs', github: 'wjp2013/aliyun-mqs'

gem 'rake', '~> 10.1.0'
3

3 Answers

1
votes

1) rake assets:precompile just compile your resources from app/assets to public/assets. So, try to remove public/assets and run rake assets:precompile. You should see compiled resources in public/assets.

2) In development environment Rails doesn't serve compiled assets. It is compile it in runtime and serve all resources separately. Is it mean that then you looking at application.css in browser you see only content of this resources. Other resources will be in other resources (look at head section of your HTML page)

3) If you want to serve compiled resources from public/assets in development environment (I don't understand why you want it, but ok) you should specify config.serve_static_assets = true in your config/environments/development.rb

FYI: I recommend to read this article about Assets Pipeline.

-1
votes
# Compress JavaScripts and CSS
 config.assets.compress = true

# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true

In your production.rb file please check above both are true if not then do it and precompile.

-2
votes

config.server_static_assets = true in your environment file won't work, especially if you're using heroku.

I had this issue and tried a lot of things. Uninstall & install gems back. Here's what did the trick:

rails assets:precompile