如何在rails中自定义bulma变量

2023-12-26

我正在使用 bulmarails gem,我想自定义它使用的一些变量,特别是字体颜色。

根据布尔玛文档http://bulma.io/documentation/overview/customize/ http://bulma.io/documentation/overview/customize/我应该做这样的事情:

// 1. Import the initial variables
@import "../sass/utilities/initial-variables"

// 2. Set your own initial variables
// Update blue
$blue: #72d0eb
// Add pink and its invert
$pink: #ffb3b3
$pink-invert: #fff
// Add a serif family
$family-serif: "Merriweather", "Georgia", serif

// 3. Set the derived variables
// Use the new pink as the primary color
$primary: $pink
$primary-invert: $pink-invert
// Use the existing orange as the danger color
$danger: $orange
// Use the new serif family
$family-primary: $family-serif

// 4. Import the rest of Bulma
@import "../bulma"

但是我不确定如何使其与我正在使用的 Rails gem 一起工作。

目前我的 application.css 文件如下所示:

/*
 * This is a manifest file that'll be compiled into application.css, 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 other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 */

@import "bulma";

效果很好。但是,如果我将其更改为 bulma 文档中的示例,即使更改也不再有效@import "../bulma" to @import "bulma" and @import "../sass/utilities/initial-variables" to @import "sass/utilities/initial-variables"

我想这里的问题是第一次导入变量,但我不知道如何导入它。这是 gem 中的文件:https://github.com/joshuajansen/bulma-rails/blob/master/app/assets/stylesheets/sass/utilities/variables.sass https://github.com/joshuajansen/bulma-rails/blob/master/app/assets/stylesheets/sass/utilities/variables.sass

Thanks!


好的,成功了。

我创建了一个名为application.css.scss in the app/assets/stylesheets目录并添加以下内容:

$blue: #72d0eb;
$pink: #ffb3b3;
$pink-invert: #fff;
$family-serif: "Merriweather", "Georgia", serif;
$primary: $pink;
$primary-invert: $pink-invert;
$family-primary: $family-serif;

@import "bulma";

这很好用。添加初始导入语句会导致失败,我尝试了一下尝试让路径正确,但对我来说总是失败。不确定这是否有任何我没有看到的意义,但无论如何现在对我有用。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在rails中自定义bulma变量 的相关文章

随机推荐

  • 使用 AVX 指令禁用 exp() 优化?

    我正在使用 AVX 内在函数在 VC 中编写前馈网络 我通过 C 中的 PInvoke 调用此代码 当调用计算大循环 包括函数 exp 的函数时 对于 160M 的循环大小 我的性能约为 1000 毫秒 我一打电话any使用 AVX 内在函
  • 省略指向结构的指针的前向声明是否有效? [复制]

    这个问题在这里已经有答案了 我最近遇到这条评论 https stackoverflow com questions 62837798 two structs that refer to each other 62838943 comment
  • 使用 docker 提供多个张量流模型

    看过了this https github com tensorflow serving issues 1077github问题和this https stackoverflow com questions 45749024 how can
  • 解释 ExtJS 4 事件处理

    我最近开始学习 ExtJS 并且很难理解如何处理事件 我没有任何以前版本的 ExtJS 的经验 通过阅读各种手册 指南和文档页面 我已经弄清楚了如何使用它 但我不清楚它是如何工作的 我找到了几个针对旧版本 ExtJS 的教程 但我不确定它们
  • Pygame 快速像素读取

    好吧 希望有人能帮助我 因为我在这里不知所措 我正在用 python 开发一款游戏 它使用相机作为主控制器 要玩游戏 您只需移动一个简单的灯光即可控制游戏 到目前为止 我已经成功地将相机图像获取到表面 并将其显示在屏幕上 但当涉及到寻找光时
  • 如何知道文本文件中流读取器的位置(行号)?

    一个例子 这可能不是现实生活 但为了阐明我的观点 public void StreamInfo StreamReader p string info string Format The supplied streamreaer read 0
  • 如何根据 WPF DataGrid 中的更改更新 ObservableCollection 项的属性?

    我有一个 WPF DataGrid 其数据源是 ObservableCollection 它的松散设置如下 public class ItemDataCollection ObservableCollection
  • 无法创建调试桥:无法启动adb服务器:无法检测adb版本

    我目前在打开项目时遇到这个问题 事件日志中显示的错误 无法检测 adb 版本 退出值 0xc0000409 adb 输出 adb exe F 11 11 09 55 06 17768 944 fdevent poll cpp 64 无法创建
  • 在 Ubuntu 上启动 Apache2 失败

    我使用 Ubuntu 和 MYSQL 安装指南进行 OSQA 遵循起来非常简单 直到我到达最后一步 即启动 Apache2 服务器 我仔细检查了一下是否错过了前面的任何步骤 而我确实错过了一个 这是 sudo ln s etc apache
  • 构成最大总和的数字

    我刚刚编写了我的程序 它从数组中找到最大和 但我陷入困境 有什么方法可以找到哪些数字对最大总和做出了贡献 给出最大总和规则 相邻元素不应贡献 合计 我对数组中最大总和的解决方案 public class MaximumELementInAR
  • Java - 设置类路径

    我的示例应用程序告诉我 No qtjambi deployment xml found in classpath loading libraries via java library path 我希望我的应用程序使用qtjambi depl
  • 从 PowerShell 运行 cmd /c,文件路径中包含空格

    我正在尝试在 PowerShell 中运行以下命令 PS C Users Administrator gt cmd c C Program Files x86 Microsoft Visual Studio 2017 BuildTools
  • 为什么我会看到“Nodetool 状态连接被拒绝”?

    我已经通过运行 Ubuntu 16 的 EC2 实例上的服务安装了 Cassandra 但我一生都无法理解为什么我无法使 nodetool 状态正常工作 我听说我应该更改 cassanda env sh 以包含主机名 我已经在这里完成了 a
  • 在 MATLAB 中使用 Levenberg-Marquardt (lsqcurvefit) 获取协方差矩阵

    我正在使用 Matlab 中的 lsqcurvefit 函数对一些实验数据进行建模 数据采用特定的形状 因此算法只是调整该形状的系数来改变其幅度等 该模型运行良好并且拟合良好 我已经计算了卡方 Levenberg Marquardt 算法的
  • 为什么要使用开始活动?

    我一直在浏览 API 文档 并注意到从 API 级别 16 开始Context http developer android com reference android content Context html类包含以下方法 public
  • 使用房间时“无法合并 dex”

    我正在尝试向我的项目添加一个 房间 当我尝试构建项目时 出现错误 错误 任务 app transformDexArchiveWithExternalLibsDexMergerForDebug 执行失败 java lang RuntimeEx
  • 将 IDataErrorInfo 与嵌套对象结合使用

    我正在使用 MVVM 我想使用 IDataErrorInfo 来验证我的视图 我当前的实现包括嵌套对象和不同的 ViewModel 例如业务实体 客户 包含业务实体 地址 我在我的视图中直接访问地址 例如 Customer Address
  • 如何使 Protobuf 3 字段成为必填字段?

    我正在使用 GRPC proto buffers 在 GoLang 中编写我的第一个 API 端点 我对 Go 还很陌生 以下是我为测试用例编写的文件 package my package import context testing gi
  • 未找到 Mysqli 类。使用percona、php5-fpm、nginx、phalcon

    Fatal error Class TKStdlib mysqli not found in var www tk browser app application library tk stdlib DbAbstract php on li
  • 如何在rails中自定义bulma变量

    我正在使用 bulmarails gem 我想自定义它使用的一些变量 特别是字体颜色 根据布尔玛文档http bulma io documentation overview customize http bulma io documenta