materializecss 框架 rails 4.2 集成
materializecss framework rails 4.2 integration
我找到了 this css 框架,不幸的是,它缺少 gem 像 Twitter bootstrap 那样的支持。
所以我下载了他们的 sass 源代码并尝试集成到 rails 资产管道中,尽管有错误。
Undefined variable: "$button-height".
(in /app/assets/stylesheets/components/_buttons.scss:4)
或者我应该把它放到 /lib 文件夹中吗?
我的问题是:如何使用 rails 4.2 安装此框架?
您可以使用 bower
或使用此 gem https://github.com/mkhairi/materialize-sass
我在使用 Bower 实现字体时遇到了一些问题,我建议使用 gem =)
我找到了将 gem 添加到 Gemfile
中的解决方案
就这样:
gem 'materialize-sass'
并更新 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";
:)
我找到了 this css 框架,不幸的是,它缺少 gem 像 Twitter bootstrap 那样的支持。
所以我下载了他们的 sass 源代码并尝试集成到 rails 资产管道中,尽管有错误。
Undefined variable: "$button-height".
(in /app/assets/stylesheets/components/_buttons.scss:4)
或者我应该把它放到 /lib 文件夹中吗?
我的问题是:如何使用 rails 4.2 安装此框架?
您可以使用 bower
或使用此 gem https://github.com/mkhairi/materialize-sass
我在使用 Bower 实现字体时遇到了一些问题,我建议使用 gem =)
我找到了将 gem 添加到 Gemfile
中的解决方案就这样:
gem 'materialize-sass'
并更新 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";
:)