gpt4 book ai didi

ruby-on-rails-3 - uglifier 无法在 Rails 中工作

转载 作者:行者123 更新时间:2023-12-03 00:49:54 26 4
gpt4 key购买 nike

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
...

我的 javascript 文件位于 app/assets/javascripts 中。我的 javascript 文件没有被压缩。关注了这个网址http://dev.mensfeld.pl/category/rails3/锻炼压缩力。

感谢您的指导。

最佳答案

在环境/生产.rb中:

...
config.assets.compress = true
...

关于ruby-on-rails-3 - uglifier 无法在 Rails 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7371432/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com