Ruby on rails Rails 3.1.3使用compass+;编译资产时在暂存服务器中出错;苏西+;哈姆勒+;scss
我的应用程序在compass和sussy for haml和scss的开发环境中运行良好,应用程序的Gemfile配置为-: 我的application.rb设置如下-:Ruby on rails Rails 3.1.3使用compass+;编译资产时在暂存服务器中出错;苏西+;哈姆勒+;scss,ruby-on-rails,ruby,ruby-on-rails-3,haml,compass-sass,Ruby On Rails,Ruby,Ruby On Rails 3,Haml,Compass Sass,我的应用程序在compass和sussy for haml和scss的开发环境中运行良好,应用程序的Gemfile配置为-: 我的application.rb设置如下-: if defined?(Sass) config.sass.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets" config.sass.load_paths << "#
if defined?(Sass)
config.sass.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
config.sass.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/blueprint/stylesheets"
config.sass.load_paths << "#{Gem.loaded_specs['compass-susy-plugin'].full_gem_path}/sass"
end
config.assets.precompile << /(^[^_]|\/[^_])[^\/]*/
如果我尝试提供的一些黑客和补丁,则会出现错误-:
Error compiling asset application.css:
Sass::SyntaxError: Undefined variable: "$base-font-size".
(in /var/www/App-staging/releases/20120405100127/app/assets/stylesheets/_mobile-first.scss)
Served asset /application.css - 500 Internal Server Error
Compiled application.css
Completed 500 Internal Server Error in 419ms
ActionView::Template::Error (File to import not found or unreadable: compass/css3/.
Load path: Sass::Rails::Importer
那么,这是Compass和rails版本的问题吗?Ans是否有任何永久性的解决方案来摆脱此配置或任何用于暂存和生产环境的工作配置。
谢谢您的帮助。您确定您的部署脚本正在调用assets:precompile,并将RAILS\u ENV设置为staging,如下所示:
bundle exec rake assets:precompile RAILS_ENV=staging
你能在你的开发机器上运行上面的命令吗 确保使用导入SASS文件
"import _mobile-first";
此外,在Rails3.1中,正确的文件名是
mobile_first.css.erb.scss
注意:您不需要前导下划线
这将允许您使用scss导入导入文件,同时仍然使用erb使用asset path helper插入资源
<%= asset_path 'twitter.png' %>
您正在使用旧版本的指南针宝石。升级到0.12.1
如果仍然不起作用,请尝试从application.rb中删除这些行
if defined?(Sass)
config.sass.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
config.sass.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/blueprint/stylesheets"
config.sass.load_paths << "#{Gem.loaded_specs['compass-susy-plugin'].full_gem_path}/sass"
end
如果定义?(Sass)
config.sass.load_路径没有为#提供错误未定义的方法“sass”;您还使用了较旧的compass gem版本。尝试升级到最新版本
config.assets.precompile << /(^[^_]|\/[^_])[^\/]*/