ruby-on-rails - SASS 全局变量 + Rails 3.1

标签 ruby-on-rails haml sass

我正在使用带有默认 SASS 设置的 Rails 3.1RC4。我有以下文件

application.css.scss

/*
 * This is a manifest file that'll automatically include all the stylesheets available in this directory
 * and any sub-directories. 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_tree . 
*/

_variables.css.scss
$var1 : somevalue;
...

site_layout.css.scss
@import "variables";
... Some Sass Code

但是我无法访问site_layout 中_variables.css.scss 中定义的变量。我究竟做错了什么? Rails 显然正在查找变量文件,因为它不会抛出“未找到文件”错误,如果我更改导入文件名,就会出现这种错误。仍然没有结转 vars。

有任何想法吗?

谢谢!

最佳答案

最新版本的 rails & sprockets 似乎解决了这个问题。在您的 gemfile 中:

gem 'rails', :git => "git://github.com/rails/rails.git", :branch => "3-1-stable"

关于ruby-on-rails - SASS 全局变量 + Rails 3.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6393195/

相关文章:

php - Laravel 4 的 Mthaml Composer 包 - 如何?

if-statement - SCSS : using @if to include only certain selectors on compilation

ruby-on-rails - 基本的每个循环 Ruby on Rails

html - 每页页脚边距都不同

html - 在 Ionic3 中使用 SCSS 为页面上所有元素的背景和文本着色

ruby-on-rails - 使用范围来过滤 Rails 5 中的结果

ruby-on-rails - Capistrano 部署问题

ruby-on-rails - rhc 设置 - 未找到命令

ruby-on-rails - 以编程方式禁用 Rails 中 Twilio 号码的传入 SMS 消息

HAML 在 #each 之后呈现数组