加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails-3 – uglifier在rails中不起作用

发布时间:2020-12-16 20:54:20 所属栏目:百科 来源:网络整理
导读:config/application.rb...# Enable the asset pipelineconfig.assets.enabled = true# Version of your assets,change this if you want to expire all your assetsconfig.assets.version = '1.0'config.assets.digest = trueconfig.assets.paths "#{Rails.r
config/application.rb
...
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets,change this if you want to expire all your assets
config.assets.version = '1.0'
config.assets.digest = true
config.assets.paths << "#{Rails.root}/vendor/assets/images" 
...


config/environment.rb
...
ENV['RAILS_ENV'] ||= 'production'
...

My gemfile
...
gem 'uglifier'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',"  ~> 3.1.0"
  gem 'coffee-rails',"~> 3.1.0"
  #gem 'uglifier'
end
...

environment/production.rb
....
    config.active_support.deprecation = :notify
    config.assets.enabled = true
    config.assets.js_compressor  = :uglifier
    config.assets.css_compressor = :scss
    config.assets.compress = false
...

我在app / assets / javascripts中有我的javascript文件.我的javascript文件没有被压缩.按照这个url http://dev.mensfeld.pl/category/rails3/进行锻炼压缩.

谢谢你的任何指示.

解决方法

在environment / production.rb中:
...
config.assets.compress = true
...

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读