materializecss框架rails 4.2集成

The*_*ner 1 ruby-on-rails css-frameworks asset-pipeline ruby-on-rails-4

我发现这个 css框架,遗憾的是,它缺乏像Twitter bootstrap那样的gem支持.

所以我下载了他们的sass源并尝试集成到rails资产管道,尽管有错误.

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

或者我应该把它放入/ lib文件夹?在此输入图像描述

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

小智 5

你可以bower使用这个宝石https://github.com/mkhairi/materialize-sass

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


小智 5

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

做就是了:

gem 'materialize-sass'
Run Code Online (Sandbox Code Playgroud)

并更新Gems,搜索您的assets/stylesheets applications.css如果你有".css"扩展名,你需要将它重命名为applications.scss,最后添加这个import @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";
Run Code Online (Sandbox Code Playgroud)

:)