【问题标题】:dynamic colors in the html :roothtml 中的动态颜色:root
【发布时间】:2022-01-12 13:15:20
【问题描述】:

我需要一个带有来自数据库的动态颜色的页面。在 sass 文件中,我在变量中有样式

$color-primary: #56b4d8;

$theme-colors: (primary: $color-primary,
secondary: #56b4d8,
success: #0ebd65,
info: #198ae3,
warning: #fed713,
danger: #e64b4b,
light: #f8f9fa,
dark: #1a1a1a);

应用于 boostrap 类的原色(text-primary、bg-primary、btn-primary)我希望 sass $ color-primary 变量填充我来自 DB 的数据

我正在使用 asp.net core html、sass 和 gulp。这是可能的

【问题讨论】:

  • 您可能需要升级到使用 CSS 变量作为主题的 Bootstrap 5.0。以前的版本需要编译 LESS/SASS 代码,不能是动态的。

标签: javascript html css sass gulp


【解决方案1】:

我认为您必须添加 asp.net 问题的标签,因为这是主要问题所在。

您不能将动态变量发送到 Sass,但可能存在生成 Sass 文件的 ASP.NET 扩展。

请记住,Sass 文件不能直接在网页中读取,它们必须首先编译为标准 CSS,而这正是 Gulp 正在做的事情

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-07-11
    • 2020-03-29
    • 1970-01-01
    • 2018-06-03
    • 1970-01-01
    • 2015-07-28
    • 1970-01-01
    相关资源
    最近更新 更多