我正在尝试使用新的compass-rails gem设置rails 3.2 app
https://github.com/Compass/compass-rails
我想使用compass watch命令编译assets文件夹中的文件 - 因为我想部署到heroku,但到目前为止我还没有成功。
compass-rails gem页面说明:
使用指南针观察者进行开发
使用Compass观察器更新样式表时,只要保存Sass文件,就会重新编译样式表。在这种模式下,编译的样式表将被写入项目的公共文件夹,因此将由项目的Web服务器直接提供 - 取代正常的rails编译。
在这种模式下,通过禁用Sass :: Plugin,rails 3.0或更早版本的用户将会略微加速:
config.after_initialize do
Sass::Plugin.options[:never_update] = true
end
但是我没有把这个配置选项放到哪里
有什么想法吗?
== EDIT ==
我尝试在application.rb
中添加config.after_initialize块require File.expand_path('../boot', __FILE__)
# require 'rails/all'
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
# require "sprockets/railtie"
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module Salsacaribecouk
class Application < Rails::Application
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# 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.after_initialize do
Sass::Plugin.options[:never_update] = true
end
end
end
但是当我运行rails服务器时,我收到一条错误消息:
block in <class:Application>': uninitialized constant Sass::Plugin (NameError)
答案 0 :(得分:0)
config.after_initialize
如果您希望在所有环境中执行config\application.rb
,或config\environments\[development|test|production].rb
在特定环境中执行,则应放在{{1}}。