materializecss框架rails 4.2集成

时间:2015-01-27 12:39:41

标签: ruby-on-rails ruby-on-rails-4 asset-pipeline css-frameworks

我发现了this css框架,不幸的是,它缺乏像Twitter bootstrap那样的gem支持。

所以我下载了他们的sass源代码并试图集成到rails资产管道中,尽管有错误。

Undefined variable: "$button-height".
  (in /app/assets/stylesheets/components/_buttons.scss:4)

或者我应该把它放到/ lib文件夹中?enter image description here

我的问题是:如何使用rails 4.2安装此框架?

2 个答案:

答案 0 :(得分:5)

您可以使用bower或使用此gem https://github.com/mkhairi/materialize-sass

我在使用bower实现字体时遇到了一些问题,我建议使用gem =)

答案 1 :(得分:5)

我找到了将gem添加到Gemfile中的解决方案

只是这样做:

gem 'materialize-sass'

并更新Gems,搜索您的资产/样式表applications.css如果您有“.css”扩展名,则需要将其重命名为 applications.scss ,最后添加此导入 @import“materialize”;

/*
 * This is a manifest file that'll be compiled into application.scss, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require_tree .
 *= require_self
 */
 @import "materialize";

:)